2021-11-18

Angular pipe could not be found

 


Angular pipe could not be found



Reference URL: https://stackoverflow.com/a/40463405


see this is working for me.

ActStatus.pipe.ts First this is my pipe

import {Pipe,PipeTransform} from "@angular/core"; @Pipe({ name:'actStatusPipe' }) export class ActStatusPipe implements PipeTransform{ transform(status:any):any{ switch (status) { case 1: return "UN_PUBLISH"; case 2: return "PUBLISH"; default: return status } } }



main-pipe.module.ts in pipe module, i need to declare my pipe/s and export it.

import { NgModule } from '@angular/core'; import {CommonModule} from "@angular/common"; import {ActStatusPipe} from "./ActStatusPipe.pipe"; // <--- @NgModule({ declarations:[ActStatusPipe], // <--- imports:[CommonModule], exports:[ActStatusPipe] // <--- }) export class MainPipe{}



app.module.ts user this pipe module in any module.

@NgModule({ declarations: [...], imports: [..., MainPipe], // <--- providers: [...], bootstrap: [AppComponent] })



you can directly user pipe in this module. but if you feel that your pipe is used with in more than one component i suggest you to follow my approach.

  1. create pipe .

  2. create separate module and declare and export one or more pipe.

  3. user that pipe module.

How to use pipe totally depends on your project complexity and requirement. you might have just one pipe which used only once in the whole project. in that case you can directly use it without creating a pipe/s module (module approach).










2021-11-16

gzip with -9 option

 
A log file: with size of: 789M

gzip with different option, to have different compression as below

gzip -9 file.log
32M


gzip -9 file.log
37MB




example #2


-rw-r--r--. 1 srvusr srvusr  87M Jul 18 19:53 output.log.20220718_pm074234.log
-rw-r--r--. 1 root   root    87M Jul 21 12:01 output.log.20220718_pm074234.without9.log


sudo gzip -9 output.log.20220718_pm074234.log
sudo gzip output.log.20220718_pm074234.without9.log


-rw-r--r--. 1 srvusr srvusr 4.0M Jul 18 19:53 output.log.20220718_pm074234.log.gz
-rw-r--r--. 1 root   root   4.2M Jul 21 12:01 output.log.20220718_pm074234.without9.log.gz





Google Referrals