Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit d168589

Browse files
matiboypkozlowski-opensource
authored andcommitted
docs(typeahead): show custom template implementation
Closes #1441
1 parent d7bf5c1 commit d168589

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/typeahead/docs/demo.html

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
1+
<script type="text/ng-template" id="customTemplate.html">
2+
<a>
3+
<img ng-src="http://upload.wikimedia.org/wikipedia/commons/thumb/{{match.model.flag}}" width="16">
4+
<span bind-html-unsafe="match.label | typeaheadHighlight:query"></span>
5+
</a>
6+
</script>
17
<div class='container-fluid' ng-controller="TypeaheadCtrl">
28

39
<h4>Static arrays</h4>
4-
<pre>Model: {{selected| json}}</pre>
10+
<pre>Model: {{selected | json}}</pre>
511
<input type="text" ng-model="selected" typeahead="state for state in states | filter:$viewValue | limitTo:8">
612

713
<h4>Asynchronous results</h4>
8-
<pre>Asynchronous values model: {{asyncSelected| json}}</pre>
14+
<pre>Model: {{asyncSelected | json}}</pre>
915
<input type="text" ng-model="asyncSelected" placeholder="Locations loaded via $http" typeahead="address for address in getLocation($viewValue) | filter:$viewValue" typeahead-loading="loadingLocations">
1016
<i ng-show="loadingLocations" class="icon-refresh"></i>
17+
18+
<h4>Custom templates for results</h4>
19+
<pre>Model: {{customSelected | json}}</pre>
20+
<input type="text" ng-model="customSelected" placeholder="Custom template" typeahead="state as state.name for state in statesWithFlags | filter:{name:$viewValue}" typeahead-template-url="customTemplate.html">
1121
</div>

src/typeahead/docs/demo.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)