Knobs-addon: Angular Components lose interactivity after adjusting property via knob
See original GitHub issueDescribe the bug When adjusting properties on an Angular component via a Knob, the Angular component interactions start having issues.
To Reproduce Steps to reproduce the behavior:
- Configure a story using the code snippet below
- Change a property using the knob add-on (change the first label to “error”)
- Click the Second Tab in the preview pane
- Notice the tab content does not change
- Click the tab content
- Notice the tab switches
The example leverages @angular/material
, but I came across this via proprietary components as well.
Expected behavior Component should continue to work as expected after changing property via knob.
Code snippets
storiesOf('Tabs', module)
.addDecorator(
moduleMetadata({
imports: [
BrowserAnimationsModule,
MatTabsModule,
MatIconModule,
],
}),
)
.add(
'with knobs',
() => ({
template: `
<mat-tab-group>
<mat-tab *ngFor="let item of items">
<ng-container *matTabLabel>
<mat-icon>{{ item.icon }}</mat-icon>
<span>{{ item.label }}</span>
</ng-container>
<ng-container *matTabContent>
Content
</ng-container>
</mat-tab>
</mat-tab-group>
`,
props: {
items: object('items', [
{
label: 'first',
icon: 'home',
},
{
label: 'second',
icon: 'face',
},
{
label: 'third',
icon: 'group_work',
},
{
label: 'fourth',
icon: 'grade',
},
{
label: 'fifth',
icon: 'feedback',
},
], 'TABS-GROUP'),
}
}),
{ notes: 'My notes' }
);
System:
- OS: Windows 10
- Browser: Chrome
- Framework: Angular
- Addons:
@storybook/addon-knobs
- Version: 5.1.9
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:22 (7 by maintainers)
Top Results From Across the Web
Component interaction - Angular
This cookbook contains recipes for common component communication scenarios in which two or more components share information.
Read more >Angular 2 - View not updating after model changes
I can see from my log statements and the network traffic that the JSON data being returned is changing, and my model is...
Read more >Angular & Storybook. Building & Documenting UI Components
We are going to look now into the process step by step, from creating a component, using Storybook to work on it and...
Read more >Angular Development #10 - RouteReuseStrategy - Intertech
Overview. Angular provides a powerful built in router to emulate traditional web page navigation and display new components when accessing ...
Read more >How to Write Better Components in Angular - Bits and Pieces
Pouring the above into a single html file is not ideal, as the app grows we will have too many codes in the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just checked that with the official sample (storybook/examples/angular-cli v6.0.0-alpha.33). The same thing, it stops working after changing visibility using
*ngIf
.But it works with v5.0.11 So, I believe @andrei-ilyukovich is right about the root cause - comment.
I’m still seeing this issue in 5.2.5.
tried with 5.3.0-alpha.34, but the knob wasn’t showing up at all! I think that’s a different issue though…
edit: I’m only seeing this issue when using addon-docs. That might change things