2014-09-12 23 views
0

我有這個Angular.js UI-Bootstrap問題。 typeahead-template-url="typeahead/bind-node.html"未在預先輸入模板中呈現表達式的{{}}。我不知道爲什麼。在Chromium調試器中,我在元素檢查器中驗證了這一點,其中字面{{match}}而不是表達式評估。typeahead-template-url無法呈現模板中的{{}}表達式

我也用'console.log()'驗證過,返回到getNodeLabel($viewValue)的對象是好的。

HTML:

<input type="text" id="label" name="label" ng-model="$parent.node.id" typeahead-min-length="1" 
     placeholder="Node Name/Label" 
     typeahead-template-url="typeahead/bind-node.html" style="width:350px;" 
     typeahead-editable="false" 
     typeahead="dropDownItem as dropDownItems.label for dropDownItem in getNodeLabel($viewValue)" 
     typeahead-loading="loadingNodeLabels" class="form-control" required> 
<i ng-show="loadingNodeLabels" class="glyphicon glyphicon-refresh"></i> 

預輸入HTML:

<script type="text/ng-template" id="bind-node.html"> 
<a> 
{{match}} 
<span bind-html-unsafe="match.label | typeaheadHighlight:query" class="ng-binding"> 
<i>{{match.label}}</i> 
<h1>{{match}}</h1> 
</span> 
</a> 
</script> 
+0

失配'dropDownItem' VS'dropDownItems' ?? – charlietfl 2014-09-12 22:47:59

+1

當你說它不是「渲染表達式的{{}}」時,你在HTML中獲得空格還是「{{}}」? – bmleite 2014-09-12 22:58:26

+0

我在html中獲得實際的ASCII大括號{{}}。 – dman 2014-09-13 18:25:26

回答

0

id="bind-node.html"需要是id="typeahead/bind-node.html"