What are the advantages of using controller as syntax instead of $scope?

坚强是说给别人听的谎言 提交于 2019-12-11 04:12:56

问题


One of the things that different Angular learning materials seem to be doing differently is passing variables. What is the difference between using $scope or the "someCtrl as some" syntax? What are the advantages? Should I stick with always using one of them or there are certain scenarios when using one of them is better than the other?


回答1:


Todd Motto has some very good articles on this!

Digging into Angular’s “Controller as” syntax A better way to $scope, angular.extend, no more “vm = this”



来源:https://stackoverflow.com/questions/30970922/what-are-the-advantages-of-using-controller-as-syntax-instead-of-scope

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!