Ngx-bootstrap: Dropdown failed to run init.

Created on 31 Mar 2017  路  6Comments  路  Source: valor-software/ngx-bootstrap

Hi, I'm using:

  • @angular/cli: 1.0.0
  • node: 7.5.0
  • os: darwin x64

For now, I can't start using the dropdown component as it throwing the error as the image attached.

screen shot 2017-03-31 at 6 19 28 pm

This is my component html:

<div class="jumbotron vertical-center" style="background-color: #fff;">
  <div class="container" style="text-align: center;">
      <div class="btn-group" dropdown>
        <button dropdownToggle type="button" class="btn btn-primary dropdown-toggle">
          Button dropdown <span class="caret"></span>
        </button>
        <ul *dropdownMenu class="dropdown-menu" role="menu">
          <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>
          <li class="divider dropdown-divider"></li>
          <li role="menuitem"><a class="dropdown-item" href="#">Separated link</a>
          </li>
        </ul>
      </div>
  </div>
</div>

Is it something wrong with my code or this is a bug?

comp(dropdown)

Most helpful comment

I have replaced the modulename and I iuse the templatesyntax '*dropdownMenu' but still have the problem.

import { BsDropdownModule } from 'ng2-bootstrap/dropdown';

BsDropdownModule.forRoot(),

```html



EDIT1: dropdown changed to bsdropdown and dropdownToggle changed to bsdropdownToggle fixed the problem. Maybe the examples should be changed --> https://valor-software.com/ng2-bootstrap/#/dropdowns 

EDIT2: I thought I fixed the problem yesterday with my changes (see EDIT1), but the dropdownMenu still does not work. Only the "filter-error" disappeared. I had to change line 85 - 87 in \node_modules\ng2-bootstrap\dropdown\bs-dropdown.directive.js" 
to this:
```js
 this._subscriptions.push(this._state
            .isDisabledChange
            .subscribe(function (value) { if (value === true) { this.hide(); } }));

for a temporary fix.

Thanks

All 6 comments

I'm having the same issue. There seem to have been some big changes to the dropdown last night, so i'm guessing this might be a bug

See #1838 for explaination: v1.6.0 introduced breaking change. You can see it in changelog. Solution: use 1.4.2 or any version prior breaking change. Alternate solution: change your code to replace module name according to changelog.

I have replaced the modulename and I iuse the templatesyntax '*dropdownMenu' but still have the problem.

import { BsDropdownModule } from 'ng2-bootstrap/dropdown';

BsDropdownModule.forRoot(),

```html



EDIT1: dropdown changed to bsdropdown and dropdownToggle changed to bsdropdownToggle fixed the problem. Maybe the examples should be changed --> https://valor-software.com/ng2-bootstrap/#/dropdowns 

EDIT2: I thought I fixed the problem yesterday with my changes (see EDIT1), but the dropdownMenu still does not work. Only the "filter-error" disappeared. I had to change line 85 - 87 in \node_modules\ng2-bootstrap\dropdown\bs-dropdown.directive.js" 
to this:
```js
 this._subscriptions.push(this._state
            .isDisabledChange
            .subscribe(function (value) { if (value === true) { this.hide(); } }));

for a temporary fix.

Thanks

@MoiraG thanks for your suggestion! Would be great if they could get this fix applied. Its difficult for me to hack this into all my environments...

@johnlee already merged in a better version https://github.com/valor-software/ng2-bootstrap/pull/1836

will be published in a sec

Was this page helpful?
0 / 5 - 0 ratings