无法在 Angular Lib 中将 TRANSLOCO 与 Storybook 一起使用
Can't use TRANSLOCO with Storybook in Angular Lib
我正在开发 Angular 13 库,我想实现故事书,所有库的组件都包括 TRANSLOCO。
所以,当我创建故事时,我看不到它们,因为我有这样的问题:
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 (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 (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)
感谢大家的帮助
我解决了在 moduleMetadata 中导入 TranslocoModule 的问题。所以故事的结果是:
export default {
title: 'storytitle',
component: 'storycomponent',
decorators: [
moduleMetadata:({
imports: [ TranslocoModule ]
})
],
} as Meta
我正在开发 Angular 13 库,我想实现故事书,所有库的组件都包括 TRANSLOCO。 所以,当我创建故事时,我看不到它们,因为我有这样的问题:
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 (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 (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)
感谢大家的帮助
我解决了在 moduleMetadata 中导入 TranslocoModule 的问题。所以故事的结果是:
export default {
title: 'storytitle',
component: 'storycomponent',
decorators: [
moduleMetadata:({
imports: [ TranslocoModule ]
})
],
} as Meta