我正在为输入元素使用angularUI 字体。我正在使用自定义模板来显示值。它一切正常。我的问题是如何将其分离ng-template
到一个单独的文件中,以便它也可以在其他文件中重复使用。
如果我的话不清楚,请注意我指的是ng-templates
具体而不关心单独的其他 html 内容
这是代码:
// custom template begin
// this is the ng-template
// I'd like to move this custom template into to another file
// similar to partials
<script type="text/ng-template" id="customTemplate.html">
<a>
<b>{{match.model.name}}</b>
<div>{{match.model.username}}</div>
</a>
</script>
//custom template end
// input element makes use of the ng-template defined above
<div class="form-group">
<label class="col-md-2 control-label normal" for="assignTo">Assign To</label>
<div class="col-md-3">
<input name="bug_assignTo" id="bug_assignTo" ng-model="bug.assignTo" typeahead="user.username as user.name for user in config.users | filter:$viewValue | limitTo:8" class="form-control input-sm" typeahead-on-select="bug.assignTo = $item" placeholder="type name" typeahead-template-url="customTemplate.html"></input>
</div>
把它放在一个部分不起作用,例如:
<div ng-include="app/client/bug/new/my-ng-template.partial.html"></div>
抛出:
Tried to load angular more than once.
[$rootScope:infdig] 10 $digest() iterations reached. Aborting!
...
....