AngularJS typeahead和结果中的html

AngularJS typeahead和结果中的html,angularjs,Angularjs,我有一个观点是这样的: <input class="form-control" type="text" name="accountNumber" ng-model="controller.order.accountNumber" typeahead-on-select="controller.onSelect($item)" typeahead="item.title + '<br />' + item.value + '<br />' + item.detail

我有一个观点是这样的:

<input class="form-control" type="text" name="accountNumber" ng-model="controller.order.accountNumber" typeahead-on-select="controller.onSelect($item)" typeahead="item.title + '<br />' + item.value + '<br />' + item.detail for item in controller.autoComplete($viewValue)" />

我尝试向返回的结果集中添加一些格式。 这实际上在这个视图上工作得很好(dispite visual studio抱怨引号)

另一方面,我有以下设置:

<input class="form-control" type="text" name="sku" ng-model="controller.orderLine.sku" typeahead-on-select="controller.onSelect($item)" typeahead="item.value + '<br />' + item.title + '<br />' +  item.detail for item in controller.autoComplete($viewValue)" />

在此视图中,中断显示为文本


我想没有人知道为什么?

我通过创建默认模板修复了这个问题:

<a href tabindex="-1">
    <div ng-if="match.model.title"><h4>{{ match.model.title }}</h4></div>
    <div ng-if="match.model.value">{{ match.model.value }}</div>
    <div ng-if="match.model.value">{{ match.model.detail }}</div>
</a>

我的typeahead html如下所示:

<div class="col-xs-12 col-md-4">
    <form name="searchForm" role="form">
        <input class="form-control" type="text" placeholder="Search" ng-model="controller.selected" typeahead-on-select="controller.onSelect()" typeahead-template-url="template/typeahead/typeahead-account-match.html" typeahead="item.accountNumber as item for item in controller.autoComplete($viewValue)" />
    </form>
</div>

注意:您可以看到我正在将typeahead模板url设置为上面的模板。如果您的模板不太可能更改,那么您可以忽略该属性,只需覆盖template/typeahead/typeahead match.html,它就会使用该属性

我希望这能帮助其他人:)