angularjs - Difference between onLoad and ng-init in angular -


i learning angular. don't understand difference between onload , ng-init initialization of varibale. in scope creates variable.

for example

<ng-include onload="selectedreq=reqselected" src="'partials/abc.html'"></ng-include> 

or

<ng-include ng-init="selectedreq=reqselected" src="partials/abc.html"></ng-include> 

please give me idea isolated scope.

ng-init directive can placed inside div's, span's, whatever, whereas onload attribute specific ng-include directive functions ng-init. see mean try like:

<span onload="a = 1">{{ }}</span> <span ng-init="b = 2">{{ b }}</span> 

you'll see second 1 shows up.

an isolated scope scope not prototypically inherit parent scope. in laymen's terms if have widget doesn't need read , write parent scope arbitrarily use isolate scope on widget widget , widget container can freely use scopes without overriding each other's properties.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -