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\">" [ "Russia <img src=\"img/ru.gif\">"
, "USA <img src=\"img/us.gif\">" , "United States of America <img src=\"img/us.gif\">"
, "UK <img src=\"img/gb.gif\">"] , "United Kingdom <img src=\"img/gb.gif\">"]

@ -23,7 +23,7 @@ angular.module('typeahead', ['ui.bootstrap', 'radians'])
<body> <body>
<div class='container-fluid' ng-controller="TypeaheadCtrl"> <div class='container-fluid' ng-controller="TypeaheadCtrl">
<pre>Model: {{ selected | json }}</pre> <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>
</div> </div>
</body> </body>

@ -10,12 +10,12 @@
<script src="../dist/radians.js"></script> <script src="../dist/radians.js"></script>
<script> <script>
angular.module('typeahead', ['ui.bootstrap', 'radians']) angular.module('typeahead', ['ui.bootstrap', 'radians'])
.controller('TypeaheadCtrl', function ($scope, $http) { .controller('TypeaheadCtrl', function($scope, $http, limitToFilter, ignoreImgFilter) {
$scope.selected = "" $scope.selected = ""
$scope.states = function(query){ $scope.states = function(query){
return $http.get("states.json").then(function(response){ return $http.get("states.json").then(function(response){
console.log("response", 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> <body>
<div class='container-fluid' ng-controller="TypeaheadCtrl"> <div class='container-fluid' ng-controller="TypeaheadCtrl">
<pre>Model: {{ selected | json }}</pre> <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> </div>
</body> </body>
</html> </html>

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