I'd like to know how to do to make the False ng-class.
page.isSelected(1) is TRUE if the page if the page is selected, else FALSE
<div id="homePage" ng-class="{ center: page.isSelected(1) }">
I therefore want you if:
isSelected is TRUE: center
isSelected is FALSE: left
I tried:
<div id="homePage" ng-class="{ page.isSelected(1) 'center : 'left' }">
but it doesnt work.
I do not know what I'm doing wrong. Can you help me please?
Just make a rule for each case:
<div id="homePage" ng-class="{ 'center': page.isSelected(1) , 'left': !page.isSelected(1) }">
Or use the ternary operator:
<div id="homePage" ng-class="page.isSelected(1) ? 'center' : 'left'">