angular-commons
v6.0.2
Published
Small collection of classes that we use across all projects
Downloads
2
Readme
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