您好我正在AngularJS組件上工作,需要幫助如何使用$ watch內的Constructor()如下我附加了我的代碼結構。
import template from './Mypage.component.html';
export const MyComponent = {
template,
bindings: {
myData: '<'
},
controller: class MyController {
constructor($scope) {
$scope.$watch(() => this.myData, newVal => {
this._myFunction();
});
}
}