我有一个Angular Component(v1.6.5),它在其控制器中包含以下简化场景:
var $ctrl = this;
$ctrl.$onInit = function () {
$ctrl.dataItem = {
showsOK: true
}
// works fine
$ctrl.updateValues('showsOK2', true);
// this definition is being passed to another component
this.subComponentDefinition= {
eventListeners: [
{
name: 'click',
callback: function (event, map) {
// this is the callback where UpdateValues
// does not update the view
$ctrl.updateValues('showsOK3', false);
}
}
],
};
}
$ctrl.updateValues = function (prop, val) {
$ctrl.dataItem[prop] = val;
};
我可能会遗漏新版Angular处理这些绑定的方法。在调用回调之前的某个时刻是否绑定了绑定?