0

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>

1
  • Can you create a demo pleasE? Commented Mar 16, 2017 at 13:21

2 Answers 2

3

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

WRONG:

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

RIGHT:

<div ng-show="value[0].ActiveQ">
Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments