user7586639
user7586639

Reputation:

Angular ng show Missing attribute value

I am trying to hide or show a button depending if a value is defined or undefined, but I am getting a missing attribute name in ng-show:

<md-list ng-cloak flex ng-repeat="(key, value) in $ctrl.questionWithCorrectAnswers | groupBy: 'QuestionID'">
<fieldset ng-class="{'notActiveQuestion': value[0].ActiveQ == 0}">
    <legend>
        <ng-show="value[0].ActiveQ"><md-button class="md-raised md-primary"><span ng-if="value[0].ActiveQ == 1">De</span>activate</md-button></ng-show>
    </legend>
</fieldset>

Upvotes: 0

Views: 644

Answers (2)

lharsh18
lharsh18

Reputation: 26

Please have a look into angular documentation for ng-show. We can use ng-show directive as element, but it also expect ng-show attribute as well.

https://docs.angularjs.org/api/ng/directive/ngShow.

Upvotes: 0

Jeremy Thille
Jeremy Thille

Reputation: 26370

ng-show is an attribute, it goes on an element.

WRONG:

<ng-show="value[0].ActiveQ">

RIGHT:

<div ng-show="value[0].ActiveQ">

Upvotes: 3

Related Questions