$watch controller memebers independent controllerAs allias#780
$watch controller memebers independent controllerAs allias#780gilhanan wants to merge 1 commit intojohnpapa:masterfrom gilhanan:patch-1
Conversation
watching controller members should not be depend on chosen controllerAs alias name, it's hard to maintenance, and can make confusing by using multiple instance of controller.
|
@gilhanan what's the difference? you used it inside your function, and the original uses the syntactic sugar as a string. but both have so, mostly the difference is that in your version it takes up some more space since it requires you to write another function. |
|
@thatkookooguy The difference is when using the syntactic sugar, you have to use the variable declared in the scope, which can be confuse and hard to maintenance, because it's managed outside the the function. For example if one day you rename the controllerAs allias or remove it, you have to refactor your watches |
|
@gilhanan oh now I understand. But if you follow the entire style-guide, the controllerAs name is always related to the actual controller name. So, you should change all your so there's not too much to remember or to get confused by if you keep the style of the entire style-guide eco-system. |
Watching controller members should not be depend on the controllerAs alias name, it's hard to maintenance, and can make confusing when using multiple instances of the controller in view.