【发布时间】:2023-03-17 16:14:01
【问题描述】:
我正在使用 applyType 方法更新我的模型,但这些项目没有反映在 UI 中。
这就是我正在做的事情
我的模型是:model.js
export default function model(
$scope,
) {
...
model.$name = 'editModelController';
model.$templateUrl = {
sku: templateUrl,
};
我的组件:
index.js
export default function addItemDialog(app) {
app.component('addItemDialog', {
controller,
bindings: {
resource: '<',
ngIf: '=',
},
});
}
addItemDialog.js
export default function addItem(
$q,
$mdDialog,
) {
this.$onInit = () => {
...
this.applyType();
};
}
this.applyType = () => {
this.units = this.loadMoreUnits();
};
addItem.$inject = [
'$q',
'$mdDialog',
];
addItemDialog.pug
md-select.select(
ng-model="$ctrl.unit",
placeholder="Unit",
name="unit",
)
md-option.select__option(
ng-repeat="unit in $ctrl.units",
value="{{ unit.unit }}",
)
.select__option-content
span.select__option-text {{ unit.description }}
我正在控制台记录 this.units 它在那里更新但未在 UI 中更新。
【问题讨论】: