sim kaur
sim kaur

Reputation: 163

show a div with ng if ionic

<ion-view cache-view="false">
<div class="navbar-fixed-top navbar-header bar bar-header " ng-if="showHeader">
<div class="container row">
           <div>
            <a class="navbar-brand" href="#">
                        <h1>ROCK 'N' GRILL<br>
                        <span>Pitampura New Delhi...</span></h1>
                    </a>
                </div>

                {{showSubHeader}}
            <div ng-if="showSubHeader===true" class="topPull" draggable >
            <button ng-if="showSubHeader" class="button-icon"><img src="img/topImg.jpg"></button>
                           </div>      
        </div>               

</div>
</ion-view>

The value of showSubHeader changes to false but yet I see the div in my view. How do I update view to not show the div when the value is false?

Edit:

This is veiw attached to an abstract state so I believe , the abstract state is not updated when views are switched. How do I reload header when views change or switch?

Upvotes: 0

Views: 3099

Answers (1)

threxx
threxx

Reputation: 1243

Instead of using ng-if you could use ng-show. So when showSubHeader is false, your div won't be shown. Have a look here: https://docs.angularjs.org/api/ng/directive/ngShow

Upvotes: 1

Related Questions