We need to inject the Angular form module into the application.
menuItems: Array
We are going to add a list of radio buttons to select what property we are going to sort by.
Update the ngModel and value attributes.
[(ngModel)]
- Represents the component variable associated with the control. [value]
- the input value for the ngModel variable"'price'"
- The item inside quotes is treated like a JS object. We use the extra ' to convert the value
to string.(change)
- binds an output event.
const direction = (this.sortDirection === 'asc') ? 1 : -1;
this.menuItems.sort((a, b) => {
if (a[this.term] < b[this.term]) {
return -1 * direction;
} else if (a[this.term] > b[this.term]) {
return 1 * direction;
} else {
return 0;
}
})
This is where your website address gets stored. You have to have your URL registered before you can have a public site.
Read more here.Gists are small shared code snippets or individual files that don't need a full blown repository.
DocsManaging code snippets can be hard through the Github website. Cacher provides a clean and easy way to manage and share code snippets.
We're going to look at code for this.
angular example