Package Exports
- select-dropdown
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (select-dropdown) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Select Dropdown
Select Dropdown is an angular component that allows you to create a dropdown selection by passing in a few parameters.
Installation
npm install select-dropdown
In app.module
import { SelectDropdownModule } from 'select-dropdown';
@NgModule({
declarations: [
AppComponent
],
imports: [
SelectDropdownModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Inputs
// Required parameters
options: Map<any, any> | any[]; // the dropdown options (can be a map or an array)
name: string; // the label for the dropdown
// Optional parameters
default: any; // the default selected option, by default, none is selected
readonly: boolean // default is false
Outputs
onSelect: EventEmitter<any>; // emits the value when an option is selected
Usage
"onSelect" is the event listener. When an option is selected, it will emit the key if its a Map and the value if its an Array.
someFunction(event: any) {
console.log(event); // will log the color
// if its a map, it will log the key, not the value.
}
<select-dropdown [name]="'Colors'" [options]="['Blue', 'Red', 'Green']"
[default]="'Red'" (onSelect)="someFunction($event)"></select-dropdown>
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.