angular-commons
TypeScript icon, indicating that this package has built-in type declarations

6.0.2 • Public • Published

angular-commons

Small collection of classes that we use across all projects

Install

npm i --save "angular-commons"
# then install the peerDependencies

This also require angular-bootstrap-ui(https://github.com/llafuente/angular-bootstrap-ui)

Base

Base is the class to extends all your components.

  • Handle subscriptions, unsubscribe on ngDestroy
  • Handle timeouts, clear them on ngDestroy
  • Growls (using ngx-toastr)
  • Parse route parameters (string/number)
  • Get data from resolves
  • Confirmation modals

We recomend to extends base with your own needs like handle HTTP errors, then extends directly your class.

Pipes

nl2br

<span [innerHTML]="yourTextWithNewLines | nl2br"

Services

SessionStorageService

  • set/get values in localStorage.
  • You can subscribe to a key to see if change.

NOTE: Save objects as JSON

LogService

Proper loggin service with timestamp, color support, levels.

Component

RootComponent

Component used for "empty routes". It's just contains a router-outlet.

import * as Views from "./";
import { RootComponent } from "./../Root.component";
 
export const routes = [
  {
    path: "parent",
    component: RootComponent,
    children: [
      {
        path: "",
        component: Views.ParentIndex,
      },
      {
        path: "xxx",
        component: Views.ParentXXX,
      },
    ]
  }
];

publish

npm publish .

LICENSE

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i angular-commons

Weekly Downloads

4

Version

6.0.2

License

none

Unpacked Size

452 kB

Total Files

38

Last publish

Collaborators

  • llafuente