[英]Angular1 Scope variables in angular2
I am using scope.$on, scope.$watch,scope.$broadcast, $scope.$apply,$scope.$emit. 我正在使用scope。$ on,scope。$ watch,scope。$ broadcast,$ scope。$ apply,$ scope。$ emit。 etc, in
angular1
. 等等,在
angular1
。 but when i try to write my code in angular2
, i heard these properties are not valid in angular2
. 但是当我尝试用
angular2
编写代码时,我听说这些属性在angular2
中angular2
。 so anyone suggest substitute for those kind of stuff. 所以有人建议用这种东西代替。
Nothing you mentioned exists in Angular2. 您在Angular2中没有提到任何内容。
In Angular2 you use services and observables instead. 在Angular2中,您可以使用服务和可观察对象。
See also https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#bidirectional-service 另请参阅https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#bidirectional-service
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.