<!DOCTYPE html>
<html>
<head>
<base href="." />
<title>ng-bootstrap demo</title>
<link rel="stylesheet" href="http://v4-alpha.getbootstrap.com/dist/css/bootstrap.min.css" />
<script src="https://unpkg.com/zone.js@^0.6.23/dist/zone.js"></script>
<script src="https://unpkg.com/zone.js@^0.6.23/dist/long-stack-trace-zone.js"></script>
<script src="https://unpkg.com/reflect-metadata@^0.1.8/Reflect.js"></script>
<script src="https://unpkg.com/systemjs@^0.19.40/dist/system.js"></script>
<script src="config.js"></script>
<script>
System.import('app').catch(console.error.bind(console));
</script>
</head>
<body>
<my-app>loading...</my-app>
</body>
</html>
System.config({
//use typescript for compilation
transpiler: 'typescript',
//typescript compiler options
typescriptOptions: {
emitDecoratorMetadata: true
},
paths: {
'npm:': 'https://unpkg.com/'
},
map: {
'app': './src',
'@angular/core': 'npm:@angular/core@2.0.0/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common@2.0.0/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler@2.0.0/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser@2.0.0/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic@2.0.0/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http@2.0.0/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router@3.0.0/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms@2.0.0/bundles/forms.umd.js',
'@angular/core/testing': 'npm:@angular/core@2.0.0/bundles/core-testing.umd.js',
'@angular/common/testing': 'npm:@angular/common@2.0.0/bundles/common-testing.umd.js',
'@angular/compiler/testing': 'npm:@angular/compiler@2.0.0/bundles/compiler-testing.umd.js',
'@angular/platform-browser/testing': 'npm:@angular/platform-browser@2.0.0/bundles/platform-browser-testing.umd.js',
'@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic@2.0.0/bundles/platform-browser-dynamic-testing.umd.js',
'@angular/http/testing': 'npm:@angular/http@2.0.0/bundles/http-testing.umd.js',
'@angular/router/testing': 'npm:@angular/router@3.0.0/bundles/router-testing.umd.js',
'rxjs': 'npm:rxjs@5.0.0-beta.12',
'typescript': 'npm:typescript@^2.0.6/lib/typescript.js',
'@ng-bootstrap/ng-bootstrap': 'npm:@ng-bootstrap/ng-bootstrap@1.0.0-alpha.14/bundles/ng-bootstrap.js'
},
packages: {
app: {
main: './main.ts',
defaultExtension: 'ts'
},
rxjs: {
defaultExtension: 'js'
}
}
});
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from './app';
platformBrowserDynamic().bootstrapModule(AppModule);
import { Component, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { JsonpModule } from '@angular/http';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { NgbdAlertCloseable } from './alert-closeable';
@Component({
selector: 'my-app',
template: `
<div class="container-fluid">
<hr>
<img src="https://www.google.fr/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png">
<p>
This is a demo plnkr forked from the <strong>ng-bootstrap</strong> project: Angular 2 powered Bootstrap.
Visit <a href="https://ng-bootstrap.github.io/" target="_blank">https://ng-bootstrap.github.io</a> for more widgets and demos.
</p>
<hr>
<ngbd-alert-closeable></ngbd-alert-closeable>
</div>
`
})
export class App {
}
@NgModule({
imports: [BrowserModule, FormsModule, ReactiveFormsModule, JsonpModule, NgbModule.forRoot()],
declarations: [App, NgbdAlertCloseable]
bootstrap: [App]
})
export class AppModule {}
import { Input, Component } from '@angular/core';
@Component({
selector: 'ngbd-alert-closeable',
templateUrl: 'src/alert-closeable.html'
})
export class NgbdAlertCloseable {
@Input()
public alerts: Array<IAlert> = [];
private backup: Array<IAlert>;
constructor() {
this.alerts.push({
id: 1,
type: 'success',
message: 'This is an success alert',
});
this.backup = this.alerts.map((alert: IAlert) => Object.assign({}, alert));
}
}
export interface IAlert {
id: number;
type: string;
message: string;
}
<p *ngFor="let alert of alerts">
<ngb-alert [type]="alert.type" [dismissible]="false">{{ alert.message }}</ngb-alert>
</p>