Tim
Tim

Reputation: 8919

Angular directives and the debugger

If I create an Angular directive:

App.directive('modalWindow', function(){
    return {
        restrict: 'EAC',
        link: function(scope, element) {
            elem.draggable();
        }
    }  
});

and then reference it in markup:

    <div class="modalWindow">

and then place a breakpoint on elem.draggable()

will the debugger stop at the breakpoint when the app is run?

EDIT: It is not stopping in Visual Studio, hence my question.

Upvotes: 0

Views: 3770

Answers (1)

rchawdry
rchawdry

Reputation: 1266

Are you sure the directive link function is being called? Keep in mind that when you camel case the directive name ('modalWindow'), in the HTML, it needs to be snake-cased ('modal-window'). Since you're using a restriction on either element, attribute, or class ('EAC'), first make sure that your link directive is being called. In your HTML, change this to

HTML

<div modal-window></div>

OR

<div class='modal-window'></div>

Try the debugger again and see if Visual Studio pauses now.

Upvotes: 3

Related Questions