Skip to content

Instantly share code, notes, and snippets.

@ZhenDeng
Last active January 23, 2019 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZhenDeng/67226d1afc8704213a4326fa8bb1669b to your computer and use it in GitHub Desktop.
Save ZhenDeng/67226d1afc8704213a4326fa8bb1669b to your computer and use it in GitHub Desktop.
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