Last active
January 23, 2019 02:25
-
-
Save ZhenDeng/67226d1afc8704213a4326fa8bb1669b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HTML: | |
***** Always select last one ,when add a new one, this list will select new one automatically ***** | |
<div> | |
<label>Summary: </label> | |
<select (change)="filterForeCasts($event.value)"> | |
<option *ngFor="let summary of summaries" [value]="summary" [selected]="summary == summaries[summaries.length-1]"> | |
{{summary}} | |
</option> | |
<option value="add">Add New Summary</option> | |
</select> | |
</div> | |
Component: | |
filterForeCasts(filterVal: any) { | |
if (filterVal == "0") | |
this.forecasts = this.cacheForecasts; | |
else | |
this.forecasts = this.cacheForecasts.filter((item) => item.summary == filterVal); | |
} | |
checkbox | |
<input id="priceAlert" class="notify-checkbox" type="checkbox" [checked]="priceAlert" (change)="priceAlert = !priceAlert"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment