title: How to display one element if condition with Angular JS
body: <p>I want display a select box if unity_variable equals true or just the unity if not unity_variable equals false</p>
  
  <p>I ve try this :</p>
  
  <pre><code>&lt;div ng-if="question.unity_variable == true"&gt;
       &lt;select&gt;
            &lt;option data-ng-repeat="unit in question.unity"&gt;{{unit.value}}&lt;/option&gt;
       &lt;/select&gt;
  &lt;/div&gt;
  &lt;div ng-if="question.unity_variable ==  false || question.unity_variable == ''"&gt;
       {{question.unity}}
  &lt;/div&gt;
  </code></pre>
  
  <p>And this : </p>
  
  <pre><code>&lt;div ng-show="question.unity_variable == true" ng-hide="question.unity_variable ==  false || question.unity_variable == ''"&gt;
       &lt;select&gt;
            &lt;option data-ng-repeat="unit in question.unity"&gt;{{unit.value}}&lt;/option&gt;
       &lt;/select&gt;
  &lt;/div&gt;
  &lt;div ng-show="question.unity_variable ==  false || question.unity_variable == ''"&gt;
       {{question.unity}}
  &lt;/div&gt;
  </code></pre>
  
  <p>so if i didn't put the ng-show that make for each question a select box with unity or display the twice but not respect the condition...
  Please help to find my mistake !</p>
  
  <p><img src="https://i.stack.imgur.com/aH5HB.png" alt="enter image description here"></p>
  
  <p>EDIT :</p>
  
  <p>My Json look like this for displaying controls to build a form :</p>
  
  <pre><code>{"id": "01",
      "questions": [
          {"name": "confidential data", "dbcolumn":"confidential data", "control": "input", "default_value": "", "unity": [{"value": "mmol/l"}, {"value": "autre"}], "unity_variable": true, "isnull": 0, "size":"180px", "data_type":"number", "max_length": 3},
          {"name": "confidential data", "dbcolumn":"confidential data", "control": "input", "default_value": "", "unity": "", "isnull": 1, "size":"180px", "data_type":"number", "max_length": 2},
          {"name": "confidential data", "dbcolumn":"confidential data","control": "select", "default_value": [{"name":"Femme", "value": "Femme"}, {"name":"Homme", "value": "Homme"}], "unity": "", "isnull": 0, "size":"196px", "data_type":"string"}
          ]
  }
  </code></pre>
  
  <p>My html code is :</p>
  
  <pre><code>&lt;table style="display: inline-block; float: left; max-width: 510px;"&gt;
      &lt;tr data-ng-repeat="question in group.questions"&gt;
          &lt;td&gt;{{question.name}}&lt;/td&gt;
          &lt;td&gt;
              &lt;div ng-switch on="question.control" style="display: inline-block;"&gt;
                   &lt;div ng-switch-when="input"&gt;
                       &lt;input type="text" style="width: {{ question.size }};" data-isnull="{{question.isnull}}" name="{{question.dbcolumn}}" id="{{question.dbcolumn}}" placeholder="{{question.default_value}}" maxlength="{{question.max_length}}" /&gt;
                   &lt;/div&gt;
                   &lt;div ng-switch-when="textarea"&gt;
                        &lt;textarea style="width: {{ question.size }};" data-isnull="{{question.isnull}}" name="{{question.dbcolumn}}" id="{{question.dbcolumn}}" placeholder="{{question.default_value}}"&gt;&lt;/textarea&gt;
                   &lt;/div&gt;
                   &lt;div ng-switch-when="checkbox"&gt;
                        &lt;input type="checkbox" data-isnull="{{question.isnull}}" name="{{question.dbcolumn}}" id="{{question.dbcolumn}}" /&gt;{{question.default_value}}
                   &lt;/div&gt;
                   &lt;div ng-switch-when="select"&gt;
                        &lt;select style="width: {{ question.size }};" data-isnull="{{question.isnull}}" name="{{question.dbcolumn}}" id="{{question.dbcolumn}}"&gt;
                            &lt;option data-ng-repeat="choice in question.default_value" value="{{choice.value}}"&gt;{{choice.name}}&lt;/option&gt;
                        &lt;/select&gt;
                   &lt;/div&gt;
                   &lt;div ng-switch-when="p"&gt;
                        &lt;p style="width: {{ question.size }};" data-isnull="{{question.isnull}}" name="{{question.dbcolumn}}" id="{{question.dbcolumn}}"&gt;&lt;b&gt;{{question.default_value}}&lt;/b&gt;&lt;/p&gt;
                  &lt;/div&gt;
                  &lt;div ng-switch-default&gt;
                        &lt;!-- default action --&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;div ng-if="question.unity_variable == true"&gt;
                   &lt;select&gt;
                        &lt;option data-ng-repeat="unit in question.unity"&gt;{{unit.value}}&lt;/option&gt;
                   &lt;/select&gt;
              &lt;/div&gt;
              &lt;div ng-if="question.unity_variable ==  false || question.unity_variable == ''"&gt; {{question.unity}} &lt;/div&gt;    
         &lt;/td&gt;
      &lt;/tr&gt;
  </code></pre>
  
  <p></p>
  
  <p>if i try just the simply code :</p>
  
  <pre><code>&lt;div ng-if="1 == 1"&gt;true&lt;/div&gt;
  &lt;div ng-if="1 == 2"&gt;false&lt;/div&gt;
  </code></pre>
  
  <p>The result show me true and false so i ve a syntaxe error </p>