Reputation: 68
Here's the fiddle http://jsfiddle.net/altermind/yak10smq/1/
I need to declare variable 'appetite' in the controller 'EntrynewCtrl', then pass it to the javascript function, something like that:
<script>
var a = appetite;
</script>
When I do "console.dir(scope);" I see in console:
$$childScopeClass
I can allocate that variable via console, but have no idea how to access it in the script.
UPD: gave wrong fiddle, now it's correct
Upvotes: 0
Views: 172
Reputation: 387
Please try this,
angular.element('#YOUR-ELEMENT-SELECTOR').scope().$apply(function(scope){
scope.doStuff();
});
Another way,
angular.element('.ng-scope').each(function(e, t){
console.log(t,angular.element(t).scope());
});
Upvotes: 1
Reputation: 11
you may need this tool AngularJS Batarang read this blog for more detail Debugging AngularJS Apps from the Console
angular.element(targetNode).scope()
-> ChildScope {$id: "005", this: ChildScope, $$listeners: Object, $$listenerCount: Object, $parent: Scope…}
angular.element(targetNode).isolateScope()
-> Scope {$id: "009", $$childTail: ChildScope, $$childHead: ChildScope, $$prevSibling: ChildScope, $$nextSibling: Scope…}
Upvotes: 0