Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pleerock/ng2-dropdown

Simple dropdown for your angular2 applications using bootstrap3.
https://github.com/pleerock/ng2-dropdown

Last synced: 3 months ago
JSON representation

Simple dropdown for your angular2 applications using bootstrap3.

Awesome Lists containing this project

README

        

> This repository is for demonstration purposes of how it can be implemented in Angular and is not maintaned. Please fork and maintain your own version of this repository.

# ngx-dropdown

Simple dropdown for your angular2 applications using bootstrap3. Does not depend of jquery.
If you don't want to use it without bootstrap - simply create proper css classes.
Please star a project if you liked it, or create an issue if you have problems with it.

## Installation

1. Install npm module:

`npm install ngx-dropdown --save`

2. If you are using system.js you may want to add this into `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

```typescript
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);
```

Take a look on samples in [./sample](https://github.com/pleerock/ngx-dropdown/tree/master/sample) for more examples of
usages.