将控制器用作语法而不是$ scope的优点是什么? [英] What are the advantages of using controller as syntax instead of $scope?

查看:93
本文介绍了将控制器用作语法而不是$ scope的优点是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不同的Angular学习资料似乎做的不同之一是传递变量.使用$ scope或"someCtrl as some"语法有什么区别?有什么优势?我应该坚持始终使用其中一种,还是在某些情况下使用其中一种优于另一种?

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?

推荐答案

Todd Motto 对此有一些非常好的文章!

Todd Motto has some very good articles on this!

挖掘Angular的"Controller as"语法 一种更好的$ scope方式.extend,不再有"vm = this"

这篇关于将控制器用作语法而不是$ scope的优点是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆