npm install bootstrap@4.0.0-alpha.2 --save
npm install @ng-bootstrap/ng-bootstrap --save
// map tells the System loader where to look for things
var map = {
'app': 'dist', // 'dist',
'@angular': 'node_modules/@angular',
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
'rxjs': 'node_modules/rxjs',
// add ng-bootstrap location map
'@ng-bootstrap': 'node_modules/@ng-bootstrap'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: 'main.js', defaultExtension: 'js', format: 'amd' },
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
// add ng-bootstrap package config
'@ng-bootstrap/ng-bootstrap': { main: 'index.js', defaultExtension: 'js' }
};
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.css"/>
import { Component, OnInit } from '@angular/core';
import { HTTP_PROVIDERS } from '@angular/http';
import { provideRouter, ROUTER_DIRECTIVES } from '@angular/router';
// import ng-bootstrap directives
import { NGB_DIRECTIVES, NGB_PRECOMPILE } from '@ng-bootstrap/ng-bootstrap';
import { routes } from './app.routes';
@Component({
//moduleId: module.id,
selector: 'app',
providers: [ HTTP_PROVIDERS ],
templateUrl: 'dist/app.component.html',
styleUrls: ['dist/app.component.css'],
// ng-bootstrap required precompile directives
precompile: [NGB_PRECOMPILE],
// add ng-bootstrap directives to app
directives: [
ROUTER_DIRECTIVES, NGB_DIRECTIVES
],
pipes: []
})
export class AppComponent implements OnInit {
ngOnInit() {
}
}
<p> <ngb-alert [dismissible]="false"> <strong>Warning!</strong> Better check yourself, you're not looking too good. </ngb-alert> </p>
export class AppComponent implements OnInit {
alert: IAlert[];
ngOnInit() {
this.alert = [
{
id: 1,
type: 'success',
message: 'This is an success alert',
},
{
id: 2,
type: 'info',
message: 'This is an info alert',
},
{
id: 3,
type: 'warning',
message: 'This is a warning alert',
},
{
id: 4,
type: 'danger',
message: 'This is a danger alert',
}
];
}
closeAlert(alert: IAlert) {
const index: number = this.alerts.indexOf(alert);
this.alerts.splice(index, 1);
}
}
interface IAlert {
id: number;
type: string;
message: string;
}
<p *ngFor="let alert of alerts">
<ngb-alert
[type]="alert.type"
(close)="closeAlert(alert)">\{\{ alert.message }}
</ngb-alert>
</p>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有