我試圖將countries
數據綁定到我的px組件中,這是一種先入之見。無法綁定角度爲2的數據
打印鏈接here。
關於在html中直接綁定數據,typeahead提示國家列表。但是當我通過從類傳遞數據來嘗試相同的情況下,它沒有綁定。
var AppComponent = ng
.Component({
selector: 'my-app'
})
.View({
template: `<div>
<h3>Case 1 : Working dropdown:</h3>
<px-typeahead placeholder="Enter your search query" local-candidates='["Alabama","Alaska","American Samoa","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","District Of Columbia", "South Dakota","Tennessee","Texas","Utah","Vermont","Virgin Islands","Virginia","Washington","West Virginia","Wisconsin","Wyoming"]'></px-typeahead>
<br>
<h3>Case 2 : Not working dropdown if data is bind from controller:</h3>
<px-typeahead placeholder="Enter your search query" local-candidates={{countries}}></px-typeahead>
{{countries}}
</div>`
})
.Class({
constructor: function() {
this.countries=["United States", "Antigua and/or Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan"]
}
});
認爲px-typeahead
在其屬性local-candidates
期待數據的組件以與''
陣列。 我嘗試了不同的方式綁定countries
像{{countries}}
,"countries"
etc.But沒有工作。
什麼是?它是你的組件選擇器名稱之一嗎? –
Chandru
@Chandru它的一個組成部分 – forgottofly