Angular component without selector breaks story
See original GitHub issueDescribe the bug Attempting to use storybook with an Angular component that does not have a selector results in the following error
'undefined' is not a known element:
1. If 'undefined' is an Angular component, then verify that it is part of this module.
2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (\"[ERROR ->]<undefined [primary]=\"primary\" [size]=\"size\" [label]=\"label\" (onClick)=\"onClick($event)\"></undefined>\"): ng:///StorybookModule/StorybookWrapperComponent.html@0:0"
To Reproduce Steps to reproduce the behavior:
- In any Angular Storybook project, create documentation that uses an angular component without a selector. Like this example project
- Serve the storybook documentation, navigate to the component without a selector
- Notice the story does not load, and see error in browser console
Expected behavior The story should load 😃 in sb 6.1.X, things work fine. This is only a problem in 6.2.0-alpha.X
Code snippets
@Component({
// uncomment this to fix error:
// selector: 'storybook-button',
template: ` <button>
{{ label }}
</button>`,
})
export default class ButtonComponent { }
This is not an issue if you include the selector or create the story like this:
export const button: Story = (args) => ({
template: `
<button>
{{ label }}
</button>`,
});
System Environment Info: System: OS: macOS 10.15.7 CPU: (12) x64 Intel® Xeon® CPU E5-1650 v2 @ 3.50GHz Binaries: Node: 12.14.1 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 6.14.11 - /usr/local/bin/npm Browsers: Chrome: 88.0.4324.96 Firefox: 84.0.1 Safari: 14.0.2 npmPackages: @storybook/addon-actions: ^6.2.0-alpha.19 => 6.2.0-alpha.19 @storybook/addon-essentials: ^6.2.0-alpha.19 => 6.2.0-alpha.19 @storybook/addon-links: ^6.2.0-alpha.19 => 6.2.0-alpha.19 @storybook/angular: ^6.2.0-alpha.19 => 6.2.0-alpha.19 npmGlobalPackages: @storybook/cli: 3.4.10
Additional context This code is probably the culprit
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (6 by maintainers)
Top GitHub Comments
@literalpie can you 👀 this PR https://github.com/storybookjs/storybook/pull/13939 ? would this correspond to your use case?
Crikey!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.2.0-alpha.31 containing PR #13939 that references this issue. Upgrade today to the
@next
NPM tag to try it out!Closing this issue. Please re-open if you think there’s still more to do.