javascript - AngularJS ng-show doesn't work -
i have following code:
<header class="hero-unit" id="banner" ng-include="'components/header/header.html'"></header> <div ng-include="'components/navbar/navbar.html'"></div> <div class="container"> <h3 class="site-headline">opret nyt produkt</h3> <hr> <form> <div class="container jumbotron"> <div class="col-md-12"> <select ng-model="selectedoption"> <option ng-repeat="option in options"> {{ option.name }} </option> </select> </div> <div ng-show="selectedoption.name == pool" ng-include="'components/new/new-pool.html'">test</div> </div> </form> </div> <footer class="footer" ng-include="'components/footer/footer.html'"></footer> and i'm trying show ng-include whenever selectedoption == "pool", ng-include being shown though ng-show condition isn't true.
i've tried " ==='pool'" , without ' , nothing seems work, , can't wrap head around it.
you're comparing selectedoption.name == pool, happens undefined == undefined. because of how set ng-select want compare:
selectedoption === 'pool'
see this simple plunk.
Comments
Post a Comment