Why does the second button not work, when ng-if is used?
I want to realize a button that is present only when the model value is set / not ""/ not null.
Template:
<input type="text" ng-model="blub"/>
<br/>
<button ng-click="blub = 'xxxx'">X</button>
<br/>
<button ng-click="blub = 'yyyy'" ng-if="blub.length">Y</button>
Controller:
angular.module('test', [])
.controller('Main', function ($scope) {
// nothing to do here
});
To play around: JSFiddle
ng-if
for? – Hanoiblub
for a length != 0. Then it shows me a button. In the end I want to use that button to unset the variable. This allows the user to remove the value completely. E.g.blub
is a part of an object and should only be set if the user wants it to set. – Prady