<!DOCTYPE html>
<html>
<head>
<base href="." />
<title>ng-bootstrap demo</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" />
<script src="https://unpkg.com/core-js@^2.4.1/client/shim.js"></script>
<script src="https://unpkg.com/zone.js@0.8.10/dist/zone.js"></script>
<script src="https://unpkg.com/zone.js@0.8.10/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>
<link rel="stylesheet" href="style.css" />
<script>
System.import('app').catch(console.error.bind(console));
</script>
</head>
<body>
<my-app>loading...</my-app>
</body>
</html>
var ver = {
ng: '5.0.2'
};
System.config({
//use typescript for compilation
transpiler: 'typescript',
//typescript compiler options
typescriptOptions: {
emitDecoratorMetadata: true
},
meta: {
'typescript': {
"exports": "ts"
}
},
paths: {
'npm:': 'https://unpkg.com/'
},
map: {
'app': './src',
'@angular/core': 'npm:@angular/core@' + ver.ng + '/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common@' + ver.ng + '/bundles/common.umd.js',
'@angular/common/http': 'npm:@angular/common@' + ver.ng + '/bundles/common-http.umd.js',
'@angular/compiler': 'npm:@angular/compiler@' + ver.ng + '/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser@' + ver.ng + '/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic@' + ver.ng + '/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http@' + ver.ng + '/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router@' + ver.ng + '/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms@' + ver.ng + '/bundles/forms.umd.js',
'rxjs': 'npm:rxjs@^5.5.2',
'rxjs/operators': 'npm:rxjs@^5.5.2/operators/index.js',
'tslib': 'npm:tslib/tslib.js',
'typescript': 'npm:typescript@2.4.2/lib/typescript.js',
'@ng-bootstrap/ng-bootstrap': 'npm:@ng-bootstrap/ng-bootstrap@1.0.4/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 { HttpClientModule } from '@angular/common/http';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { SuperFlyoutComponent } from './super-flyout.component';
@Component({
selector: 'my-app',
template: `
<div class="container">
<h1>Flyout example</h1>
click <button type="button" class="btn btn-sm btn-primary" (click)="onOpenFlyout()">here</button> to view flyout.
</div>
`
})
export class App
{
constructor(
private modal: NgbModal)
{
}
public onOpenFlyout = () =>
this.openFlyout();
private openFlyout()
{
this.modal.open(SuperFlyoutComponent, { windowClass: 'flyout-right' });
}
}
@NgModule({
imports: [BrowserModule, FormsModule, ReactiveFormsModule, HttpClientModule, NgbModule.forRoot()],
declarations: [
App,
SuperFlyoutComponent
],
entryComponents: [
SuperFlyoutComponent
],
bootstrap: [App]
})
export class AppModule {}
import { Component } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'app-super-flyout',
templateUrl: 'src/super-flyout.component.html',
styleUrls: ['src/super-flyout.component.css']
})
export class SuperFlyoutComponent
{
constructor(
private activeModal: NgbActiveModal)
{
}
public onClose = () =>
this.activeModal.close();
}
:host,
form {
display: flex;
flex-direction: column;
}
<form>
<div class="modal-header">
<h4 class="modal-title">Modal title</h4>
<button type="button" class="close" aria-label="Close" (click)="onClose()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body p-2">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
<small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="exampleCheck1">
<label class="form-check-label" for="exampleCheck1">Check me out</label>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-dark" (click)="onClose()">Close</button>
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
.flyout-right {
left: unset;
.modal-dialog {
@media (min-width: 576px) {
height: 100vh;
margin:0px 0px 0px 0px;
max-width: unset;
}
.modal-content {
height: 100vh;
-webkit-animation: 'slide-in' 0.5s;
animation: 'slide-in' 0.5s;
-webkit-animation-direction: alternate;
animation-direction: alternate;
}
.modal-body {
height: 100vh;
overflow-y: auto;
padding: 1rem 0px;
}
@keyframes slide-in {
0% {
right: -100%;
}
100% {
right: 0%
}
}
}
}