renamed filter ignoreImgFilter to ignoreImg

fix-space-nbsp
Dmitri Akatov 11 years ago
parent ad41b6b4a5
commit 44778c5413

@ -1,3 +1,3 @@
[ "Russia <img src=\"img/ru.gif\">"
, "USA <img src=\"img/us.gif\">"
, "UK <img src=\"img/gb.gif\">"]
, "United States of America <img src=\"img/us.gif\">"
, "United Kingdom <img src=\"img/gb.gif\">"]

@ -23,7 +23,7 @@ angular.module('typeahead', ['ui.bootstrap', 'radians'])
<body>
<div class='container-fluid' ng-controller="TypeaheadCtrl">
<pre>Model: {{ selected | json }}</pre>
<div ng-model="selected" typeahead="state for state in states | ignoreImgFilter:$viewValue" contenteditable>
<div ng-model="selected" typeahead="state for state in states | ignoreImg:$viewValue" contenteditable>
</div>
</div>
</body>

@ -10,12 +10,12 @@
<script src="../dist/radians.js"></script>
<script>
angular.module('typeahead', ['ui.bootstrap', 'radians'])
.controller('TypeaheadCtrl', function ($scope, $http) {
.controller('TypeaheadCtrl', function($scope, $http, limitToFilter, ignoreImgFilter) {
$scope.selected = ""
$scope.states = function(query){
return $http.get("states.json").then(function(response){
console.log("response", response)
return response.data
return limitToFilter(ignoreImgFilter(response.data, query), 2)
})
}
})
@ -24,7 +24,7 @@ angular.module('typeahead', ['ui.bootstrap', 'radians'])
<body>
<div class='container-fluid' ng-controller="TypeaheadCtrl">
<pre>Model: {{ selected | json }}</pre>
<div ng-model="selected" typeahead="state for state in states($viewValue)" contenteditable="true" style="width:100px; height: 20px;"></div>
<div ng-model="selected" typeahead="state for state in states($viewValue)" contenteditable="true" style="width:400px; height: 20px;"></div>
</div>
</body>
</html>

@ -33,7 +33,7 @@ angular.module('radians.contenteditable', [])
# don't highlight anything!
(matchItem, query) -> matchItem
)
.filter('ignoreImgFilter', ->
.filter('ignoreImg', ->
# when matching query against the items, ignore all img tags
(items, query) ->
item for item in items \