I am trying to implement ng-bootstrap using plunker http://plnkr.co/edit/?p=preview .
Not working, I can not find the problem
.
Below code.config.js,
(function (global) {
System.config({
paths: {
'npm:': 'node_modules/'
},
map: {
app: 'app',
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'@ng-bootstrap/ng-bootstrap': 'node_modules/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js',
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
},
packages: {
app: {
main: './main.js',
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js'
},
}
});
})(this);
Run codeapp.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { NgbdDropdownConfig } from 'app/dropdown-config';
import { AppComponent } from './app.component';
@NgModule({
imports: [ BrowserModule, ],
declarations: [ AppComponent,NgbdDropdownConfig ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
Run codeCode app.component.ts
import { Component } from '@angular/core';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { NgbdDropdownConfig } from 'app/dropdown-config';
@Component({
selector: 'my-app',
template: ` <div class="container-fluid">
<ngbd-dropdown-config></ngbd-dropdown-config>
</div>`,
})
export class AppComponent { }
Run codedropdown-config.ts code
import {Component} from '@angular/core';
import {NgbDropdownConfig} from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'ngbd-dropdown-config',
templateUrl: 'app/dropdown-config.html',
providers: [NgbDropdownConfig]
})
export class NgbdDropdownConfig {
constructor(config: NgbDropdownConfig) {
config.up = true;
config.autoClose = false;
}
}
Run codedropdown-config.html
<p>This dropdown uses customized default values.</p>
<div ngbDropdown>
<button class="btn btn-outline-primary" id="dropdownMenu3" ngbDropdownToggle>Toggle</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenu3">
<button class="dropdown-item">Action - 1</button>
<button class="dropdown-item">Another Action</button>
<button class="dropdown-item">Something else is here</button>
</div>
</div>
Run codeSince there is no error message, I cannot find the problem. Can anyone figure out what the problem is. Thank.
source
share