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

ng2-ui-collapsable

October 16, 2017
Angular 2 Accordion Component

Note

After 0.5.0 or higher, ng2-collapsable has been changed to @ngui/collapsable. Here are the changes;
  • Module ng2-collapsable is changed to @ngui/collapsable.
  • Direvtive ng2-collapsable is changed to ngui-collapsable.
  • Class name Ng2CollapsableModule is changed to NguiCollapsableModule

Demo

Install

  1. install @ngui/collapsable
     $ npm install @ngui/collapsable --save  
    
  2. add map and packages to your systemjs.config.js
     map['@ngui/collapsable'] = 'node_modules/collapsable/dist/collapsable.umd.js';  
    
  3. import NguiCollapsable to your AppModule import { NgModule } from '@angular/core'; import { FormsModule } from "@angular/forms"; import { BrowserModule } from '@angular/platform-browser'; import { AppComponent } from './app.component'; import { NguiCollapsable } from '@ngui/collapsable';
  4.  @NgModule({  
       imports: [BrowserModule, FormsModule, NguiCollapsable],  
       declarations: [AppComponent],  
       bootstrap: [ AppComponent ]  
      })  
      export class AppModule { }  
    

Use it in your template

 <ngui-collapsable  
  selected="js"  
  selected-index-class="selected"  
  selected-contents-class="slideDown animated">  
  <div index="html">HTML</div>  
  <div contents="html">HTML {{1}}</div>  
  <div index="js">Javascript</div>  
  <div contents="js">Javascript {{1}}</div>  
 </ngui-collapsable>  

For full example, please check out test directory to see the example of
  • systemjs.config.js
  • app.module.ts
  • and app.component.ts


Note: Special thanks to ng2-ui

Contact: allenhwkim@gmail.com

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