0.0.2 • Published 6 years ago

gocodee-lib-demo v0.0.2

Weekly downloads
7
License
-
Repository
github
Last release
6 years ago

LibDemo

This project was generated with Angular CLI version 7.1.4.

Motivation

This project is a exist as a small demo for beginer to know how to write a Angular Library. In this library we will learn how to know how a native angular library work and learn how to use a JS lib inside an angular app. In this demo I will use 'underscore' js lib to seperate particles in an array.

Build Status

Code Style

Tech/Framework Used

Angular 7

Installation

Add this command to the terminal: npm install gocodee-lib-demo Because in this library the 'underscore' lib is a peerDependencies so we must install it in main project with the command: npm install underscore

Tests

Unit test ng test via Karma. End-to-end test ng e2e via Protractor.

How to use

In your project module:

import 'GocodeeLibDemoModule' from 'gocodee-lib-demo'
...
@NgModule({
imports: [
  CommonModule
  GocodeeLibDemoModule.forRoot({ brand: "Some Configues"})
],
...

In the component that will run the library, enter these codes:

...
import { GocodeeLibDemoService } from 'gocodee-lib-demo';

...
export class StretchComponent implements OnInit {

  constructor(private toast: GocodeeLibDemoService) { 
    this.toast.sumValue(5,6);
  }
  
  ngOnInit() {
   ...
   this.toast.each(this.fruits,console.log);
  }
...

If you see an Error like : No provider for ViewContainerRef We could insert this line to the angular.json of your app to fix it

...
 "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/ludus-parallax",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.app.json",
       -->  "preserveSymlinks": true,
...

License

This project is a open source library of GOCODEE team in onder to serve for the education. All the example in this project is free to use for education purpose.

0.0.2

6 years ago

0.0.1

6 years ago