简体   繁体   中英

Angular1 Scope variables in angular2

I am using scope.$on, scope.$watch,scope.$broadcast, $scope.$apply,$scope.$emit. etc, in angular1 . but when i try to write my code in angular2 , i heard these properties are not valid in angular2 . so anyone suggest substitute for those kind of stuff.

Nothing you mentioned exists in Angular2.
In Angular2 you use services and observables instead.

See also https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#bidirectional-service

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM