diff --git a/src/directives/compile.js b/src/directives/compile.js new file mode 100644 index 00000000..c522985e --- /dev/null +++ b/src/directives/compile.js @@ -0,0 +1,14 @@ +angular.module('openlayers-directive').directive('compile', ['$compile','$rootScope', function($compile, $rootScope) { + return function(scope, element, attrs) { + scope.$watch( + function(scope) { + // watch the 'compile' expression for changes + return scope.$eval(attrs.compile); + }, + function(value) { + var content = $compile(value)($rootScope); + element.append(content); + } + ); + }; +}]); diff --git a/src/directives/marker.js b/src/directives/marker.js index d4078362..c50d6265 100644 --- a/src/directives/marker.js +++ b/src/directives/marker.js @@ -77,7 +77,7 @@ angular.module('openlayers-directive').directive('olMarker', function($log, $q, replace: true, template: '',