ngdemolibjor
v0.0.0
Published
Example of angular components library workaround, based on [@angular/cli] project.
Downloads
5
Readme
NgDemoLib
Example of angular components library workaround, based on @angular/cli project.
Notes
- It is @angular/cli library workaround, until angular/angular-cli#1692 will be solved
- It is based on the distributing sources files and supports
aot
build - It works well as dependency form regular @angular/cli project or ejected one
- It contains some commits to demonstrate all changes you need to make a library.
- It was generated by @angular/cli with
ng new ng-demo-lib --style scss -sd lib -p demo
- It has demo app, that could be used as documentation or sandbox. Use
ng serve -o true
to run it. - It exposes only
lib
directory.
[TL;DR] See @ns/ng-demo-app and live demo.
Usage
- create new @angular/cli project:
ng new ng-demo-app --style scss
- install library:
npm install --save git://[email protected]: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
inapp.component.html
:<demo-greeter name="Peter Pan"></demo-greeter>
- run project:
ng serve -o true
- profit