Make ng-show work for 0 length strings "" -



Make ng-show work for 0 length strings "" -

is there way create ng-show work 0 length strings ''?

class="snippet-code-js lang-js prettyprint-override">angular.module('app', []).controller('app', appcontroller); function appcontroller($scope) { $scope.zero = ''; $scope.string = 'string'; $scope.n = null; } class="snippet-code-html lang-html prettyprint-override"><script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <div ng-app="app" ng-controller="app"> <div ng-show="zero">make appear</div> <div ng-show="string">this appears, usual</div> <div ng-show="n">this should not appear, usual</div> </div>

you can this:

ng-show="zero.length >= 0"

if want 0 length strings can alter to:

ng-show="zero.length === 0"

here's plunkr: http://plnkr.co/k7dypukqhcdylauw4dua

angularjs-ng-show

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -