Skip to content

Commit

Permalink
fix(dropdown): Add the dropdown-menu class to dropdown menus
Browse files Browse the repository at this point in the history
fixes  #541, closes #732
  • Loading branch information
gpgooiker authored and valorkin committed Jul 14, 2016
1 parent fdbd493 commit 1bc316f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion components/dropdown/dropdown-menu.directive.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import {Directive, ElementRef, Host, OnInit} from '@angular/core';
import {Directive, ElementRef, Host, OnInit, HostBinding} from '@angular/core';
import {DropdownDirective} from './dropdown.directive';

@Directive({selector: '[dropdownMenu]'})
export class DropdownMenuDirective implements OnInit {
public dropdown:DropdownDirective;
public el:ElementRef;

/* tslint:disable:no-unused-variable */
@HostBinding('class.dropdown-menu')
public addClass:boolean = true;
/* tslint:enable:no-unused-variable */

public constructor(@Host() dropdown:DropdownDirective, el:ElementRef) {
this.dropdown = dropdown;
this.el = el;
Expand Down
2 changes: 1 addition & 1 deletion components/dropdown/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { DROPDOWN_DIRECTIVES } from 'ng2-bootstrap/components/dropdown';
```html
<!-- dropdown directive marks a dropdown root element -->
<div dropdown>
<!-- click on dropdown-toggle toogles dropdown state, optional -->
<!-- click on dropdown-toggle toggles dropdown state, optional -->
<div dropdownToggle></div>
<!-- dropdown-menu holds content which will be shown -->
<div dropdownMenu>
Expand Down
2 changes: 1 addition & 1 deletion demo/components/dropdown/dropdown-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<button id="single-button" type="button" class="btn btn-primary" dropdownToggle [disabled]="disabled">
Button dropdown <span class="caret"></span>
</button>
<ul class="dropdown-menu" dropdownMenu role="menu" aria-labelledby="single-button">
<ul dropdownMenu role="menu" aria-labelledby="single-button">
<li role="menuitem"><a class="dropdown-item" href="#">Action</a></li>
<li role="menuitem"><a class="dropdown-item" href="#">Another action</a></li>
<li role="menuitem"><a class="dropdown-item" href="#">Something else here</a></li>
Expand Down

0 comments on commit 1bc316f

Please sign in to comment.