Answer the question
In order to leave comments, you need to log in
AngularJS, how to initialize a directive on an event in the browser, or what is an alternative way?
Good day!
There is a directive that contains a template and a service call to request data. On a click event, I print the created tag ( <my-dir/>
), but everything is empty.
How to initialize a directive after the entire page has loaded?
Or what is an alternative way to use the same template repeatedly with a call to query data?
Answer the question
In order to leave comments, you need to log in
I don't even want to understand what nonsense you came up with... But the answer is the $parse service.
But seriously... You don't need to initialize an event directive or anything like that - you have scopes, promises, resolvers.... whatever you want to do. We initialized the directive, you can hide it and wait for the data to arrive.
run bootstrap with DOMLoad
It seems to me that this is something to do with sparrows and guns :)
Perhaps you have a specific service that requires a special approach, but in most cases it is enough to simply pull data from the model, prepare a request and send it. As a rule, it is convenient to do this in the handler responsible for the button.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question