替代在AngularJS 2.0 $范围 [英] Alternative to $scope in AngularJS 2.0

查看:261
本文介绍了替代在AngularJS 2.0 $范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近了解到,在AngularJS 2.0,也不会有 $范围

I recently learned that in AngularJS 2.0, there will be no $scope.

什么是替代品是什么?我怎么会在组件之间能够共享数据?请问范围选项在指令可用?更实际,有到当前的替代方案,我可以用?结识

What is the alternative to that? How will I be able share data between the components? Will the scope option be available in directives? More practically, is there a current alternative to that that I can get acquainted with?

我知道控制器,但我读到的控制器也将被淘汰。

I am aware of controller as but I read that controllers will be eliminated too.

困惑在这样的角度队已经开始了一场革命。结果
帮助是AP preciated!

Confused on such a revolution the Angular team has started.
Help is appreciated!

推荐答案

角2.0中使用这个而不是 $范围

Angular 2.0 is using this instead of $scope.

一个2.0未来的重大变化是控制器的死亡,一个新的重点组成部分。
对基于组件的应用程序移动大优势是,它更容易定义其接口;此外,HTML元素已经在事件容易可映射接口,属性和属性。

One of the major changes coming in 2.0 is the death of the controller, and a new emphasis on components. Big advantage of moving towards component-based apps is that it's easier to define their interfaces; plus, HTML elements already have an easily mappable interface in events, attributes, and properties.

见AngularJS 1.3迁移到2.0 这里
也看到了角2.0的完整文档<一个href=\"https://docs.google.com/$p$psentation/d/1XQP0_NTzCUcFweauLlkZpbbhNVYbYy156oD--KLmXsk/$p$pview?sle=true&slide=id.p\">here

See the Migration of AngularJS 1.3 to 2.0 here. Also see the complete documentation of Angular 2.0 here

这篇关于替代在AngularJS 2.0 $范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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