Questions tagged «angularjs-components»

7
AngularJS 1.5+组件不支持Watchers,如何解决?
我一直在将自定义指令升级到新的组件体系结构。我读过,组件不支持观察者。它是否正确?如果是这样,您如何检测对象的变化?对于一个基本示例,我有一个自定义组件myBox,该组件具有一个子组件游戏,并带有对游戏的绑定。如果游戏组件中有找零游戏,如何在myBox中显示警告消息?我知道有rxJS方法可以纯粹在角度上做到这一点吗?我的JSFiddle 的JavaScript 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 }) app.component("game", { bindings: …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.