javascript - Angular directive ng-if does not evaluate conditional statement -


i'm new web dev , angularjs. i'm trying use directive ng-if display div block if list returned database greater 1, it's not working. misusing directive? i've looked around , haven't found solutions work. currently, both divs displayed , ng-ifs ignored.

<div>     <div ng-if="listofthings.length > 1">         <h1> {{listofthings.length}} </h1>         </br>         <div ng-repeat="thing in listofthings">            <label> {{ thing.name }} </label>         </div>     </div>     <div ng-if="listofthings.length == 1" class="col-sm-4 col-sm-offset-4">         <h1> {{ listofthings[0].name }} </h1>         <iframe width="560" height="315" ng-src="{{ listofthings[0].embed }}" frameborder="0" allowfullscreen></iframe>     </div> </div> 

i tried code, works in plunker, not in code reason. in code, ng-app works, ng-if still not.

    <div ng-app="nganimate">         click me: <input type="text" ng-model="check" ng-init="check='show'" /><br/>         show when check: {{check}}         <input ng-if="check!='hide'" class="animate-if" placeholder="type word 'hide'"/>     </div> 

what want instead of ng-if="{{listofthings.length}} > 1" this:

 ng-if="listofthings.length>1" 

ng-if evaluate expression.

check online demo


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -