0
我在controller中有範圍值。我需要在自定義類型提前模板中顯示範圍值。如何訪問自定義typeahead模板中的控制器值
但自定義模板將不會訪問控制器值,它總是顯示爲空。
在我的情況下,我需要在自定義模板中顯示「scope.names」。但它顯示爲空。
如何在自定義模板中顯示控制器值。
HTML:
<div class='container-fluid typeahead-demo' ng-controller="TypeaheadCtrl">
<h4>Custom popup templates for typeahead's dropdown</h4>
<pre>Model: {{customPopupSelected | json}}</pre>
<input type="text" ng-model="customPopupSelected" placeholder="Custom popup template" uib-typeahead="state as state.name for state in statesWithFlags | filter:{name:$viewValue}" typeahead-popup-template-url="customPopupTemplate.html" class="form-control">
</div>
DEMO:
https://plnkr.co/edit/HEf0lipdBP5ZyuciQsDo?p=preview
我需要在下面的「選擇位置從下拉」在下面自定義列表從控制器 – CodeMan
顯示「$ scope.states」 和$ scope.names @CodeMan讓我明白正確。你想要顯示兩個列表的項目作爲一個下拉的值?因此,無論我們在輸入中輸入什麼,都會得到兩個列表的建議。那是對的嗎? – tanmay
是的,我想顯示兩個下拉列表 – CodeMan