Hello Everyone, I've encountered a problem that I need help with.
import { Pipe, PipeTransform } from '@angular/core';
import { PrintingTypesService } from 'src/app/settings/services/printing-types/printing-types.service';
import { PrintingTypesModel } from 'src/app/settings/share/printing-types.model';
@Pipe({
name: 'printingTypesPipe',
})
export class CustomPrintingTypesPipe implements PipeTransform {
public printingTypesData: PrintingTypesModel[] = [];
name: any;
constructor(private printingTypesService: PrintingTypesService) {}
transform(value: string): any {
this.printingTypesService.fetchPrintingTypes().subscribe((data) => {
this.printingTypesData = data;
const selectedType = this.printingTypesData.find((o: any) => {
return Number(o.printing_type_id) === Number(value);
});
this.name = '';
this.name = selectedType!.name_e;
});
return this.name;
}
}
Even though I console log the value of this.name, it doesn't display in the browser!
I've tried troubleshooting but can't pinpoint the exact issue. Any help would be greatly appreciated. Thank you!