Alternative to $scope in Angular 2.0

后端 未结 6 707
醉话见心
醉话见心 2020-12-04 23:56

In Angular 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

6条回答
  •  温柔的废话
    2020-12-05 00:26

    Angular 2 does not share data between components like Angular 1 did. Instead what they do is passing down data by using it inside the template and passing up events (by just using the bubble behaviour which events have by default). And you access data from the pattern by using the component class (Have a look at the 1000000000 "angular 2 - How to get started" videos on Youtube if you have no idea what I mean by class).

提交回复
热议问题