javascript - Accessing the isolate scope of a compiled directive -


i compiling directive using following code:

var element, $injector, $compile, link, scope;  element = angular.element(document.getelementbyid(#whatever)); $injector = element.injector(); $compile = $injector.get('$compile'); link = $compile(angular.element('<my-directive></my-directive>'));  scope = element.scope(); scope.foo = 'foo'; // want place on isolate scope! element.append(link(scope)); 

the directive has isolate scope. scope variable above gives me scope parent element. how can isolate scope directive?

angular element object has predefined functions such isolatedscope. challenge call on right element. works:

angular.element(link(scope)).isolatescope()

here hold of compiled+linked html fragment directive , call isolatedscope() function isolated scope.


Comments

Popular posts from this blog

php - Hide output during test execution -

javascript - Migrate custom AngularJS filter from 1.2.28 to 1.4.x -

Update Magento products with multiple images -