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

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -