所以我对组件、绑定和 Angular 2 范式还比较陌生。我想让我的 Angular 1.3 应用程序准备好传输,所以我一直在尝试采用新的组件指令。
不过,我无法克服不可分配的绑定错误!
这是我包含组件的地方:
<schedule currentSchedule="[]" class="panel"></schedule>
以及组件本身:
app.component('schedule', {
bindings: {
currentSchedule: "="
},
controllerAs: 'SchedCtrl',
controller: function(Schedules)
{
var scope = this
Schedules.refresh()
.then(function(result) {
scope.currentSchedule = result
})
},
templateUrl: "templates/schedule.html"
})
和组件模板:
<div ng-repeat="apt in SchedCtrl.currentSchedule | orderBy: 'App_DtTm'">
{{apt.name}}
</div>
我觉得我在这里遗漏了一些非常明显的东西。任何帮助将不胜感激。