javascript - Cannot get angular.isString to work with ng-repeat -


i'm trying angular.isstring comparison ng-if inside ng-repeat. items in array returned.

so tried output angular.isstring result doesn't output anything.

here do:

<li ng-repeat="item in data">   <div ng-if="angular.isstring(item)">     {{ item }}   </div> </li> 
function myctrl($scope) {     $scope.data =     [         "hello",         "-",         123     ]; } 

here's fiddle: http://jsfiddle.net/m6k13whh/2/

angular expressions evaluated against scope. can create function returns angular.isstring:

<li ng-repeat="item in data">   <div ng-if="isstring(item)">     {{ item }}   </div> </li>  $scope.isstring = function(item) {     return angular.isstring(item); } 

you can filter of items function:

<li ng-repeat="item in data | filter:isstring">            <div>        {{ item }}         </div> </li> 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -