Skip to content Skip to sidebar Skip to footer

How To Access Scope In A Function Inside Link Function In Angularjs Directive?

This might not be an angularJS problem but I am at my wit's end here. The code is shown below: prep.directive('resultgraph', function () { return { restrict: 'A', link:

Solution 1:

If you need the DOM to be ready you can do this inside the link function (the scope will be accessible):

$timeout(function(){
    alert('DOM ready');
    //** scope accessible here **
});

Post a Comment for "How To Access Scope In A Function Inside Link Function In Angularjs Directive?"