node package manager
Loosely couple your services. Use Orgs to version and reuse your code. Create a free org »

ng-demo-coba

NgDemoLib

Example of angular components library, based on angular-cli project.

Notes

It was generated by angular-cli with ng new ng-demo-lib --style scss -sd demo-app -p demo command and contains single commit to demonstrate the all changes you need to make a library.

This library has demo app, that could be used for documentation or sandbox purposes, and expose only lib directory. You could use ng serve -o true to run it.

Usage

[TL;DR] See ng-demo-app for usage example

  • create new angular-cli project: ng new ng-demo-app --style scss && cd ng-demo-app
  • install library: npm install --save git://git@github.com:nsmolenskii/ng-demo-lib.git
  • add module import declaration in app.module.ts:
   import { BrowserModule } from '@angular/platform-browser';
   import { NgModule } from '@angular/core';
   import { FormsModule } from '@angular/forms';
   import { HttpModule } from '@angular/http';
   import { MaterialModule } from '@angular/material';
   
   import { AppComponent } from './app.component';
   import { GreeterModule } from 'ng-demo-lib';
 
   @NgModule({
     declarations: [
       AppComponent
     ],
     imports: [
       BrowserModule,
       FormsModule,
       HttpModule,
       MaterialModule.forRoot(),
       GreeterModule
     ],
     providers: [],
     bootstrap: [AppComponent]
   })
  • use demo-greeter in app.component.html: <demo-greeter name="Peter Pan"></demo-greeter>
  • run project: ng serve -o true
  • profit