NG-点击不工作的NG-如果

问题描述:

为什么第二个按钮不起作用,NG-如果在使用?

我想实现一个按钮,为present仅当模型值设置/不是/ NOT NULL。

I want to realize a button that is present only when the model value is set / not ""/ not null.

模板:

<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>

控制器:

angular.module('test', [])
.controller('Main', function ($scope) {
    // nothing to do here
});

要玩: 的jsfiddle 骨节病>

To play around: JSFiddle

使用 NG-节目 相反的NG-如果。这应该工作。

小提琴 骨节病>