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

查看:24
本文介绍了使用控制器作为语法而不是 $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, angular 方法.extend,不再有vm = this"

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

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