<!DOCTYPE html>
<html>

  <head>
    <base href="." />
    <title>angular5 + ngx-smart-modal@7.x with target</title>
    <link rel="stylesheet" href="https://unpkg.com/ngx-smart-modal@7.0.3/ngx-smart-modal.css">
     <!-- polyfill(s) for older browsers -->
    <script src="https://unpkg.com/core-js/client/shim.min.js"></script>

    <script src="https://unpkg.com/zone.js@0.8.16?main=browser"></script>
    <!--<script src="https://unpkg.com/reflect-metadata@0.1.10"></script>-->
    <script src="https://unpkg.com/systemjs@0.20.18/dist/system.src.js"></script>
    <script src="https://unpkg.com/web-animations-js@2.3.1"></script>
  

    <script src="systemjs.config.js"></script>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <script>
        System.import('app').catch(function (err) { console.error(err); });
    </script>
  </head>

  <body>
    <my-app>
    loading...
  </my-app>
  <div id="modal_root"></div>
  </body>

</html>
//our root app component
import { Component, NgModule, VERSION} from '@angular/core'
import { BrowserModule} from '@angular/platform-browser'

@Component({
  selector: 'my-app',
  template: `<app-staff></app-staff>`
})
export class AppComponent {}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { AppStaffComponent } from './staff.component';
import { AppDepartmentComponent } from './department.component';
import { NgxSmartModalModule } from 'ngx-smart-modal';

@NgModule({
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        NgxSmartModalModule.forRoot()
    ],
    declarations: [
        AppComponent,
        AppStaffComponent,
        AppDepartmentComponent
    ],
    exports: [
      AppStaffComponent,
      AppDepartmentComponent,
      NgxSmartModalModule
    ],
    providers: [
      
    ],
    bootstrap: [AppComponent]
})
export class AppModule { }
(function (global) {
  var angVer = '5.0.0-beta.6';
 
  System.config({
    transpiler: 'ts',
    typescriptOptions: {
      "emitDecoratorMetadata": true,
      "experimentalDecorators": true,
      "lib": [ "es2015", "dom" ],
      "module": "commonjs",
      "moduleResolution": "node",
      "noImplicitAny": true,
      "sourceMap": true,
      "suppressImplicitAnyIndexErrors": true,
      "target": "es5"
    },
    meta: {
      'typescript': {
        "exports": "ts"
      }
    },
    paths: { 
      'npm:': 'https://unpkg.com/',
      'gh:': 'https://raw.githubusercontent.com/'
    },
    map: {
      "app": "app",
      "rxjs": "npm:rxjs@5.4.3",
      "ts": "npm:plugin-typescript@7.1.0/lib/plugin.js",
      "typescript": "npm:typescript@2.4.2/lib/typescript.js",
      "@angular/core": "npm:@angular/core@" + angVer + "/bundles/core.umd.js",
      "@angular/common": "npm:@angular/common@" + angVer + "/bundles/common.umd.js",
      "@angular/compiler": "npm:@angular/compiler@" + angVer + "/bundles/compiler.umd.js",
      "@angular/platform-browser": "npm:@angular/platform-browser@" + angVer + "/bundles/platform-browser.umd.js",
      "@angular/platform-browser-dynamic": "npm:@angular/platform-browser-dynamic@" + angVer + "/bundles/platform-browser-dynamic.umd.js",
      "@angular/http": "npm:@angular/http@" + angVer + "/bundles/http.umd.js",
      "@angular/router": "npm:@angular/router@" + angVer + "/bundles/router.umd.js",
      "@angular/forms": "npm:@angular/forms@" + angVer + "/bundles/forms.umd.js",
      "@angular/animations": "npm:@angular/animations@" + angVer + "/bundles/animations.umd.js",
      "@angular/animations/browser": "npm:@angular/animations@" + angVer + "/bundles/animations-browser.umd.js",
      "@angular/platform-browser/animations": "npm:@angular/platform-browser@" + angVer + "/bundles/platform-browser-animations.umd.js",
      "ngx-smart-modal": "npm:ngx-smart-modal@7.x"
},
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
      app: {
        main: './main.ts',
        defaultExtension: 'ts'
      },
      rxjs: {
        defaultExtension: 'js'
      }
    }
  });

  if (!global.noBootstrap) { bootstrap(); }

  // Bootstrap the `AppModule`(skip the `app/main.ts` that normally does this)
  function bootstrap() {

    // Stub out `app/main.ts` so System.import('app') doesn't fail if called in the index.html
    System.set(System.normalizeSync('app/main.ts'), System.newModule({ }));

    // bootstrap and launch the app (equivalent to standard main.ts)
    Promise.all([
      System.import('@angular/platform-browser-dynamic'),
      System.import('app/app.module')
    ])
    .then(function (imports) {
      var platform = imports[0];
      var app      = imports[1];
      platform.platformBrowserDynamic().bootstrapModule(app.AppModule);
    })
    .catch(function(err){ console.error(err); });
  }
})(this);
//our root app component
import { Component, NgModule, VERSION} from '@angular/core'
import { BrowserModule} from '@angular/platform-browser'

@Component({
  selector: 'app-staff',
  template: `
  <a href="javascript:void(0)" (click)="staffModal.open()">Staff A</a><br />
  <a href="javascript:void(0)" (click)="staffModal.open()">Staff B</a><br />
  <a href="javascript:void(0)" (click)="staffModal.open()">Staff C</a><br />
  
  <ngx-smart-modal #staffModal target="#modal_root" identifier="staffModal" (onOpen)="popped=true" (onClose)="popped=false" >
    <div *ngIf="popped">
      <h1>Staff's detail</h1>
      <div>
        Staff's title <br />
        Staff's info A <br />
        Staff's info B <br />
        <hr />
        <app-department></app-department>
      </div>
    
      <button (click)="staffModal.close()">Close</button>
    </div>
  </ngx-smart-modal>
`
})
export class AppStaffComponent {}
//our root app component
import { Component, NgModule, VERSION} from '@angular/core'
import { BrowserModule} from '@angular/platform-browser'

@Component({
  selector: 'app-department',
  template: `
  <a href="javascript:void(0)" (click)="departmentModal.open()">Department A</a><br />
  <a href="javascript:void(0)" (click)="departmentModal.open()">Department B</a><br />
  <a href="javascript:void(0)" (click)="departmentModal.open()">Department C</a><br />
  
   <ngx-smart-modal #departmentModal target="#modal_root" identifier="departmentModal" (onOpen)="popped=true" (onClose)="popped=false" >
    <div *ngIf="popped">
      <h1>Department's detail</h1>
      <div>
        Department's title <br />
        Department's info A <br />
        Department's info B <br />
        <hr />
        <app-staff></app-staff>
      </div>
    
      <button (click)="departmentModal.close()">Close</button>
    </div>
  </ngx-smart-modal>
  `
})
export class AppDepartmentComponent {}