I just try to call two function in single ng-init of angularjs.but it through error to me. My code:
ng-init="function1();function2();"
I don't know how to call those function correctly.anyone can give me some ideas to do it.
Thanls advance..
You can create one main function like "init" and call other functions inside that function.
ng-init="init()"
from your controller
function init() {
function1();
function2();
}
Check out the below link, and have a look at the console.
http://plnkr.co/edit/60Ry6hwiunAF12PZclNW?p=preview
HTML
<div ng-init='one(); two();'></div>
JS
$scope.one = function(){
console.log('one')
};
$scope.two = function(){
console.log('two')
};
Hope this is what you are expecting
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With