diff --git a/demo/src/app/components/+dropdown/demos/dropup/dropup.html b/demo/src/app/components/+dropdown/demos/dropup/dropup.html
index d135eb6c0f..8cd6b17d3a 100644
--- a/demo/src/app/components/+dropdown/demos/dropup/dropup.html
+++ b/demo/src/app/components/+dropdown/demos/dropup/dropup.html
@@ -1,15 +1,20 @@
-
+
-
+
+
diff --git a/demo/src/app/components/+dropdown/demos/dropup/dropup.ts b/demo/src/app/components/+dropdown/demos/dropup/dropup.ts
index 49cc2d375f..79e237f283 100644
--- a/demo/src/app/components/+dropdown/demos/dropup/dropup.ts
+++ b/demo/src/app/components/+dropdown/demos/dropup/dropup.ts
@@ -5,4 +5,5 @@ import { Component } from '@angular/core';
templateUrl: './dropup.html'
})
export class DemoDropupComponent {
+ isDropup = true;
}
diff --git a/src/dropdown/bs-dropdown.directive.ts b/src/dropdown/bs-dropdown.directive.ts
index 816576e440..bca391370c 100644
--- a/src/dropdown/bs-dropdown.directive.ts
+++ b/src/dropdown/bs-dropdown.directive.ts
@@ -12,7 +12,8 @@ import { BsDropdownState } from './bs-dropdown.state';
@Directive({
selector: '[bsDropdown],[dropdown]',
exportAs: 'bs-dropdown',
- providers: [BsDropdownState]
+ providers: [BsDropdownState],
+ host: {'[class.dropup]': 'dropup'}
})
export class BsDropdownDirective implements OnInit, OnDestroy {
/**
@@ -138,20 +139,20 @@ export class BsDropdownDirective implements OnInit, OnDestroy {
this._state.dropdownMenu
.then((dropdownMenu) => {
// check direction in which dropdown should be opened
- this.dropup = typeof this.dropup !== 'undefined' || this.dropup;
- this._state.direction = this.dropup ? 'up' : 'down';
- if (!this.placement) {
- this.placement = this.dropup ? 'top left' : 'bottom left';
- }
+ const _dropup = this.dropup === true ||
+ (typeof this.dropup !== 'undefined' && this.dropup !== false);
+ this._state.direction = _dropup ? 'up' : 'down';
+ const _placement = this.placement ||
+ (_dropup ? 'top left' : 'bottom left');
// show dropdown
this._dropdown
.attach(BsDropdownContainerComponent)
.to(this.container)
- .position({attachment: this.placement})
+ .position({attachment: _placement})
.show({
content: dropdownMenu,
- placement: this.placement
+ placement: _placement
});
this._state.isOpenChange.emit(true);