I have an ng-init
directive defined on my html
tag, with it initializing some data. I want a certain JS function to run before this initialization occurs. How can I accomplish this? Basically my objective is to assign the data returned by this function to the variable initialized in ng-init
.
this is really bad approach but this should work.
Wrap it up as self executing function ie
(function(){ //Your code })();
If you want to get the results, expose a global variable from the script file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.