Simple dropdown for your angular2 applications using bootstrap3.
npm install ngx-dropdownnpm install ngx-dropdown --save
map and package config:
json
{
"map": {
"ngx-dropdown": "node_modules/ngx-dropdown"
},
"packages": {
"ngx-dropdown": { "main": "index.js", "defaultExtension": "js" }
}
}
`
Usage
`html
`
* dropdown directive is used to specify where your dropdown starts
* dropdownToggle Indicates if dropdown should be closed when user double-clicks the dropdown opening button. Default is true.
* (onOpen) in dropdown is called when dropdown is opened
* (onClose) in dropdown is called when dropdown is closed
* dropdown-open is used on a, button or any other clickable element to open a dropdown on its click
* dropdown-not-closable-zone (not used in the example above, however is used in the examples below) is used
to prevent closing dropdown when you click on its elements. Its highly usable when you want to create
interactive dropdowns.
Sample
`javascript
import {Component} from "@angular/core";
import {DropdownModule} from "ngx-dropdown";
@Component({
selector: "app",
template:
})
export class AppComponent {
}
@NgModule({
imports: [
BrowserModule,
DropdownModule
],
declarations: [
AppComponent
],
bootstrap: [
AppComponent
]
})
export class AppModule {
}
platformBrowserDynamic().bootstrapModule(AppModule);
``