Reputation: 563
I have a link/anchor HTML like:
<a href='/some-form' ng-click='someFunction(item)'>Text</a>
What I have in mind is that user clicks this link, then I want to load an HTML from server, and after the loading of that HTML, I want someFunction
to be executed, which fills the loaded form with some data.
However, by debugging my code, it seems that Angular JS first fires someFunction
function, and then browser loads the HTML. Not only I want this to be reverse, but also I need them to be executed sequentially (synchronously).
Is my design a good design? Is there any other way to achieve this behavior? If not, what should I do to make it work?
Upvotes: 2
Views: 1247
Reputation: 18685
so I think someFunction(item)
should be in the other controller dealing with the route /some-form
.
You may also consider using $location
to manually navigate to /some-form
.
Upvotes: 3