我正在尝试通过 Angular 1.5 组件的 html 绑定字符串。我收到一条错误消息,上面写着:
Error: [$compile:nonassign] Expression ''My Title'' in attribute 'title' used with directive 'selectList' is non-assignable!
这是我调用组件的 html:
索引.html
<select-list title="'My Title'"></select-list>
和组件:
export var selectListComponent = {
bindings: {
title: "="
},
templateUrl: 'path/selectList.html',
controller: selectListController
};
和组件html:
<div>{{$ctrl.title}}</div>