ii-ngx-common
TypeScript icon, indicating that this package has built-in type declarations

1.7.33 • Public • Published

NgxCommon

Angular 2+ common components, pipes, services, directives

Installation

  1. Use npm to install the package
$ npm install ii-ngx-common --save
  1. You could either add into your module imports the NgxCommonModule in order to add all of the pipes
import { NgxCommonModule } from "ii-ngx-common";

@NgModule({
 // ...
 imports: [
   // ...
   NgxCommonModule
 ]
})

Safe pipe

Marks value that's safe to use as HTML, CSS, Script, etc.........

Usage

<div [innerHTML]="data | safe:'html'">Safe html</div>
<div [innerHTML]="data | safe:'style'">Safe css</div>
<div [innerHTML]="data | safe:'script'">Safe css</div>
<div [innerHTML]="data | safe:'url'">Safe css</div>
<div [innerHTML]="data | safe:'resourceUrl'">Safe css</div>

Unsubscribe service

Observable service which is unsubscribed after service is destroyed.

Usage

import {UnsubscribeService} from "ii-ngx-common";

@Component({
  ...
  providers: [UnsubscribeService]
})
export class MyComponent {
  constructor(unsubscribeService$: UnsubscribeService) {
    someObservable.pipe(
	  takeUntil(unsubscribeService$)
	).subscribe(() => {
	  ...
	});
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i ii-ngx-common

Weekly Downloads

16

Version

1.7.33

License

none

Unpacked Size

87.2 kB

Total Files

21

Last publish

Collaborators

  • ildar-icoosoft