Tag: angularjs components

AngularJs 1.5 – 组件不支持Watchers,这是什么工作?

我一直在升级我的自定义指令到新的组件方法。我读过这个组件不支持观察者。 它是否正确? 如果是这样,你如何检测对象的变化。 对于一个基本的例子,我有自定义组件myBox,它有一个绑定在游戏上的子组件游戏。 如果游戏组件中有更改游戏,那么我怎样在myBox中显示警报消息? 我明白有rxJS方法是可以做到这一点纯粹angular度? 我的JS FIDDLE JS FIDDLE JS var app = angular.module('myApp', []); app.controller('mainCtrl', function($scope) { $scope.name = "Tony Danza"; }); app.component("myBox", { bindings: {}, controller: function($element) { var myBox = this; myBox.game = 'World Of warcraft'; //IF myBox.game changes, show alert message 'NAME CHANGE' }, controllerAs: 'myBox', templateUrl: "/template", transclude: true […]