Showing posts with label ng2-ui-overlay. Show all posts
Showing posts with label ng2-ui-overlay. Show all posts


October 18, 2017
General Solution For Angular2 Overlay Elements


After 0.8.0 or higher, ng2-overlay has been changed to @ngui/overlay. Here are the changes
  • Module ng2-overlay is changed to @ngui/overlay
  • Direvtive ng2-overlay is changed to ngui-overlay
  • Class name Ng2Overay is changed to NguiOverlay 


  1. nstall overlay
      $ npm install @ngui/overlay  
  2. add map and packages to your systemjs.config.js
     map['@ngui/overlay'] = 'node_modules/@ngui/overlay/dist/overlay.umd.js';  
  3. import NguiOverlayModule to your AppModule import { NgModule } from '@angular/core'; import { FormsModule } from "@angular/forms"; import { CommonModule } from '@angular/common'; import { AppComponent } from './app.component'; import { NguiOverlayModule } from '@ngui/overlay';
  4.  @NgModule({  
       imports: [CommonModule, FormsModule, NguiOverlayModule],  
       declarations: [AppComponent],  
       bootstrap: [ AppComponent ]  
      export class AppModule { }  
For full example, please check out test directory to see the example of
  • systemjs.config.js
  • app.module.ts
  • and app.component.ts

Usage it in your code

You are ready. use it in your template
 <div id="window-loading" ngui-overlay-of="window">  
   <button (click)="'window-loading')">Show Loading For Window</button>  


[ngui-overlay], [ngui-overlay-of], [ngui-overlay-position]
  • ngui-overlay, Display inside overylay center-center positioned
  • ngui-overlay-of="window", Display window overlay
  • ngui-overlay-position="VERTICAL HORIZONTAL outside" e.g.,
    ngui-overlay-position="center center" for loading sign
    ngui-overlay-position="top center outside" for tooltip
    • VERTICAL positions: top, middle, or bottom
    • HORIZONTAL positions: left, center, or right
    • outside to display overlay outside of the container

Note: Special thanks to ng2-ui


Disclaimer: The blog is created to share angular directives information to geek, curious Angular Developers.