Can't use TRANSLOCO with Storybook in Angular Lib

612 Views Asked by At

i'm working on an Angular 13 lib and i want to implement storybook and all lib's compontents include TRANSLOCO. So, when i create stories i can't see those because i have issues like this:

NG0302: The pipe 'transloco' could not be found in the 'InputTextComponent' component!. Find more at https://angular.io/errors/NG0302 Error: NG0302: The pipe 'transloco' could not be found in the 'InputTextComponent' component!. Find more at https://angular.io/errors/NG0302 at getPipeDef (http://localhost:6006/vendors-node_modules_ngneat_transloco_fesm2015_ngneat-transloco_js-node_modules_storybook_add-e00a9f.iframe.bundle.js:152096:11) at ɵɵpipe (http://localhost:6006/vendors-node_modules_ngneat_transloco_fesm2015_ngneat-transloco_js-node_modules_storybook_add-e00a9f.iframe.bundle.js:152043:15) at InputTextComponent_Template (ng:///InputTextComponent.js:72:9) at executeTemplate (http://localhost:6006/vendors-node_modules_ngneat_transloco_fesm2015_ngneat-transloco_js-node_modules_storybook_add-e00a9f.iframe.bundle.js:137642:5) at renderView (http://localhost:6006/vendors-node_modules_ngneat_transloco_fesm2015_ngneat-transloco_js-node_modules_storybook_add-e00a9f.iframe.bundle.js:137371:7) at renderComponent$1 (http://localhost:6006/vendors-node_modules_ngneat_transloco_fesm2015_ngneat-transloco_js-node_modules_storybook_add-e00a9f.iframe.bundle.js:138906:3) at renderChildComponents (http://localhost:6006/vendors-node_modules_ngneat_transloco_fesm2015_ngneat-transloco_js-node_modules_storybook_add-e00a9f.iframe.bundle.js:137206:5) at renderView (http://localhost:6006/vendors-node_modules_ngneat_transloco_fesm2015_ngneat-transloco_js-node_modules_storybook_add-e00a9f.iframe.bundle.js:137405:7) at renderComponent$1 (http://localhost:6006/vendors-node_modules_ngneat_transloco_fesm2015_ngneat-transloco_js-node_modules_storybook_add-e00a9f.iframe.bundle.js:138906:3) at renderChildComponents (http://localhost:6006/vendors-node_modules_ngneat_transloco_fesm2015_ngneat-transloco_js-node_modules_storybook_add-e00a9f.iframe.bundle.js:137206:5)

thank's to everyone will help

1

There are 1 best solutions below

1
On BEST ANSWER

I resolved importing TranslocoModule in moduleMetadata. So the results of story is:

export default { 
  title: 'storytitle', 
  component: 'storycomponent',
  decorators: [ 
    moduleMetadata({ 
     imports: [ TranslocoModule ] 
    }) 
  ],
} as Meta