javascript - Comparing a variable defined from angularJS controller in HTML page -


i'm pretty new angularjs easy, have following html trying check if current page equal 0 , if so, changed class name of tag disabled. (currentpage defined 0 in controller)

<script>     if ('{{currentpage}}' == 0) {         document.getelementbyid("prev").classname = "disabled";     }     if ('{{currentpage}}' >= '{{eventslist}}'.length / '{{pagesize}}' - 1) {         document.getelementbyid("next").classname = "disabled";     } </script> 

however, whenever try check this, never sees currentpage zero. added else statement see currentpage is.

<script>     if ('{{currentpage}}' == 0) {         document.getelementbyid("prev").classname = "disabled";     } else {         document.getelementbyid("prev").innerhtml = "{{currentpage}}";     }     if ('{{currentpage}}' >= '{{eventslist}}'.length / '{{pagesize}}' - 1) {         document.getelementbyid("next").classname = "disabled";     } </script> 

after doing this, sure enough, come zero. ideas why if statement fails on simple? in advanced!

<div id="prev" ng-class="{'disabled': currentpage === 0}"> <span ng-if="currentpage !== 0">{{currentpage}}</span> </div> <div id="next" ng-class="{'disabled': currentpage >= eventslist.length / pagesize - 1}"></div> 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -