2

I am new to AngularJs. I have written a custom directive in AngularJs. The link for the same can be found here: Link to plunkr. I have added the alerts on loading of the page and on clicking the individual links.

My specific question is why is the alert message "Loaded the custom directive." being triggered after the link is clicked. I was under the impression that The message will be called only on document load and not on every time the links are clicked. Am I doing an mistake or this is the intended behavior.

Please let me know where I am going wrong.

zilcuanu
  • 3,451
  • 8
  • 52
  • 105

1 Answers1

1

you are changing the page when you click the anchor

<a href="#" class="ops-block">

simply delete the hash.

Is an empty href valid?

Community
  • 1
  • 1
ranf
  • 56
  • 2