Skip to content

Instantly share code, notes, and snippets.

@craigjbass
Created July 11, 2014 13:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigjbass/20e98b1fd72cff69c957 to your computer and use it in GitHub Desktop.
Save craigjbass/20e98b1fd72cff69c957 to your computer and use it in GitHub Desktop.
Implements the converse to ng-non-bindable: "ng-bindable" (only compiles mark up within <angular> tags, this is useful for legacy applications which cannot have {'s and }'s escaped easily.)
angular.module( 'ng-angular-element', [] )
.directive( 'angular', function() { return { restrict: 'E' }; } )
.directive( 'html', ['$compile', '$rootScope', '$document',
function( $compile, $rootScope, $document ) {
return {
restrict: 'E',
compile: function(scope, element, attributes) {
angular.forEach( $document.find( 'angular' ), function( angularElement ) {
$compile(angularElement)($rootScope);
} );
},
terminal: true
}
}] );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment