I'm having a select tag with three options. Each of them i want to use {if}{/if}
to check the conditionals to display or not, but it's cause a problem when it render the first option with content
<option value="? string:detail ?" selected></option>
Here is my code:
<select ng-model="report_type" name="report_type">
{if (isReportView)}<option value="detail">Detail view</option>{/if}
{if (isReportView)}<option value="summary">Summary view</option>{/if}
{if (isSalaryView)}<option value="salary">Salary view</option>{/if}
</select>
With isReportView
is false
, the first and second did not displayed is right, but it's also rendered another option tag as i mention above. So how to prevent it render that option?
In Angular you use "ng-show" To show or hide. For example in your code:
<select ng-model="report_type" name="report_type">
<option ng-show="isReportView" value="detail">Detail view</option>
<option ng-show="isReportView" value="summary">Summary view</option>
<option ng-show="isSalaryView" value="salary">Salary view</option>
</select>