Gbuomprisco / ng2-material-dropdown

Angular 2 Material-like Dropdown Component
MIT License
37 stars 54 forks source link

Angular CLI Usage #12

Closed baruchvlz closed 8 years ago

baruchvlz commented 8 years ago

Just putting this here for anyone wondering, this is how i made the dropdown components work with Angular CLI:

app.module.ts

...
import { MaterialModule, ... } from '@angular/material';
import { Ng2DropdownModule } from 'ng2-material-dropdown';

@NgModule({
  ...,
  imports: [
    ...,
    Ng2DropdownModule 
  ]
})

navbar.component.html

<md-toolbar color="" class="nav-bar">
  <div class="nav-bar__left">
    <button md-icon-button>
        <md-icon class="default">menu</md-icon>
    </button>
  </div>
  <div class="nav-bar__right">
    <ng2-dropdown>
      <ng2-dropdown-button>
        <md-icon class="default">notifications_none</md-icon>
      </ng2-dropdown-button>
      <ng2-dropdown-menu>
        <ng2-menu-item>
          Item
        </ng2-menu-item>
      </ng2-dropdown-menu>
    </ng2-dropdown>
  </div>
</md-toolbar>

The only thing I couldn't get to work was the divider

Unhandled Promise rejection: Template parse errors: 'ng2-menu-divider' is not a known element:

sufian07 commented 8 years ago

Same for me, Unhandled Promise rejection: Template parse errors: 'ng2-menu-divider' is not a known element:

Gbuomprisco commented 8 years ago

Hi @sufian07, @baruchvlz

Thanks, I've updated the Readme (after a long time!).

Please use ng2-menu-divider as a class instead, not as element. :)