0

I want to toggle my select then show another input based on what I selected.

Owned:
<select ngModel="selectedValue">
 <option value="true">Yes</option>
 <option value="false">No</option>
</select>
<input *ngIf="selectedValue==false" type="date">
2
  • [(ngModel)]="selectedValue" Commented Jun 24, 2018 at 4:24
  • Also, you can use *ngIf="!selectedValue" Commented Jun 24, 2018 at 4:29

1 Answer 1

3
<select [(ngModel)]="selectedValue">
  <option value="true">Yes</option>
  <option value="false">No</option>
</select>
<div *ngIf="selectedValue"> Selected value is: {{selectedValue}}</div>
<input *ngIf="selectedValue == 'false'" type="date">
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, this line of code solved my problem "selectedValue == 'false'" --> 'false'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.