0
我想通過一個角度爲1.5的組件綁定一個字符串。我得到一個錯誤,指出消息:錯誤使用Angular 1.5組件綁定字符串
Error: [$compile:nonassign] Expression ''My Title'' in attribute 'title' used with directive 'selectList' is non-assignable!
這是我在哪裏調用組件的HTML:
的index.html
<select-list title="'My Title'"></select-list>
和組件:
export var selectListComponent = {
bindings: {
title: "="
},
templateUrl: 'path/selectList.html',
controller: selectListController
};
和組件html:
<div>{{$ctrl.title}}</div>
謝謝西蒙,起初我試着用'<'來進行單向綁定,但我想這不是原始數據類型?標記爲回答,但確切地說是錯誤的 – Shawn
這是正確的,'<'是針對對象的。 –