angular-common-module
v0.0.5
Published
Small collection of classes that we use across all projects
Downloads
2
Readme
angular-common-module
Small collection of classes that we use across all projects
Install
npm i --save "angular-common-module" "[email protected]"
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 ng2-toasty)
- 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