AngularJS Tutorial 20 - Controller As Syntax

preview_player
Показать описание
In this video we have discussed about Controller As syntax in angular JS

In my previous video we have learnt about nested controller in that child controller will inherit the data from its parent scope.
When you bind the property on $scope in nested controller you will unexpected output

So everytime when you access property inside parent scope you have to access the property using $parent property in angularjs.

But this lead to again lot of confusion because with each level deep you need to add $parent for immediate parent. so in this case it is very difficult to remember the scope of controller

So to get rid from this issue you can create an alias of your controller so that wherever you want to access parent scope , all you need to use mention the alias name that will act like a object
So first rule to create Controller-As Syntax is you need to bind the properties of controller on this rather then $scope object.

});

parentController as parent

Visit my facebook page@

Рекомендации по теме
Комментарии
Автор

Awesome . hey nisha since I also have been doing programming demo videos of similar kind can we think of making couple of videos together...

euSupinho
Автор

hi can you upload what is broadcast and emit videos

rabindrasahu
Автор

Awesome . hey nisha since I also have been doing programming demo videos of similar kind can we think of making couple of videos together...

euSupinho