<!DOCTYPE html>
<html>

  <head>
    <title> Angular 2 Modal – Salesforce - Example   </title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://www.lightningdesignsystem.com/assets/styles/slds.css">
    <link rel="stylesheet" href="styles.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.0/es6-shim.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.25/system-polyfills.js"></script>
    <script src="https://npmcdn.com/angular2@2.0.0-beta.15/es6/dev/src/testing/shims_for_IE.js"></script>
    <script src="https://code.angularjs.org/2.0.0-beta.15/angular2-polyfills.js"></script>
    <script src="https://code.angularjs.org/tools/system.js"></script>
    <script src="https://npmcdn.com/typescript@^1.8.10/lib/typescript.js"></script>
    <script src="https://code.angularjs.org/2.0.0-beta.15/Rx.js"></script>
    <script src="https://code.angularjs.org/2.0.0-beta.15/angular2.dev.js"></script>
    <script src="https://npmcdn.com/ng-lightning@0.7.0/ng-lightning.bundle.js"></script>
    <script>
      System.config({
        transpiler: 'typescript',
        typescriptOptions: { emitDecoratorMetadata: true },
        packages: {'app': {defaultExtension: 'ts'}},
        paths: {
          'tether': 'https://cdnjs.cloudflare.com/ajax/libs/tether/1.2.0/js/tether.js'
        },
      });
      System.import('app/main').then(null, console.error.bind(console));
    </script>
  </head>
 
  <body>
    <h1 style="height:50px; padding : 10px; font-size: 19px">
        Angular 2 Modal – Salesforce - Example     
      </h1>
     <a target="_blank" href="http://www.angulartypescript.com/angular-2-tutorial/" title="Angular 2 Tutorial"> 
     <img src="http://www.angulartypescript.com/wp-content/uploads/2016/03/learn-more-angular-2.png" alt="Smiley face" height="200" width="500">   
    </a>
    <my-app>Loading...</my-app>
  </body>

</html>


<!-- 
Copyright 2016 angulartypescript.com. All Rights Reserved.
Everyone can use this source code; don’t forget to indicate the source please:
http://www.angulartypescript.com/ 
-->
/* Styles go here */

<div style="padding-left:10px;padding-top:10px">
  
<button type="button" nglButton="neutral" (click)="open()">Open Angular 2 Modal</button>
<button type="button" nglButton="neutral" (click)="open('large')">Open large</button>

<ngl-modal header="Angular 2 Modal Header" [(open)]="opened" [size]="size">
   <div body>
 
<p>
When the Modal window is displayed (opened) the Tab button (Keyboard)
can be used to navigate inside the Modal window.</p>
<p>
We can use the ESC button from the keyboard to close the Modal window.
</p>
<p>
Angular 2 Modal dialog developed using The Lightning Design System CSS
Framework.
</p>
   </div>
  <button class="slds-button slds-button--neutral" (click)="cancel()">Cancel</button>
  <button class="slds-button slds-button--neutral slds-button--brand">Save</button>
</ngl-modal>
</div>
import {bootstrap}  from 'angular2/platform/browser';
import {Component} from 'angular2/core';
import {NGL_DIRECTIVES, provideNglConfig} from 'ng-lightning/ng-lightning';

@Component({
  selector: 'my-app',
  directives: [NGL_DIRECTIVES],
  templateUrl: 'app/angular-2-modal.html'
})
export class Angular2Modal {

    opened: boolean = false;
    size: string;

    open(size: string) {
      this.size = size;
      this.opened = !this.opened;
    }

    cancel() {
      this.opened = false;
    }
}

bootstrap(Angular2Modal, [provideNglConfig()]);