Use constructor inside a story
See original GitHub issueIs it possible to inject a service inside a storybook using a contstructor or something else?
We are implementing storybook with our angular components. And it would be nice if we can do something like:
export const story = () => ({
template: `
<my-component (click)="clicked()"></my-component>
`,
constructor(private customService: MyCustomService): void {
},
props: {
clicked(): void {
this.customService.doSomething();
}
}
});
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:7
Top Results From Across the Web
Adding Custom Constructors (How To) - Treehouse
then click on Code > Generate > Constructor, select both and click OK. 0:35. All right, so let's use these back in our...
Read more >Constructor in Java | DigitalOcean
When a constructor calls another constructor of the same class, it's called constructor chaining. We have to use this keyword to call another ......
Read more >Java Constructor Basics: What They Are & How to Use Them
In Java, a constructor is a term that describes a line of code used to create an instance of a class object. Since...
Read more >How do I call one constructor from another in Java?
Instead of calling a constructor within a constructor, use the Factory pattern. A static factory method first creates all lower-level ...
Read more >Constructors in Java - A Complete Guide - BeginnersBook
Java Copy Constructor · By creating a parameterized constructor with class reference as parameter. · By using clone() method of the Object class....
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
I have similar problem, I want to build FormGroup with FormBuilder, but cannot figure out how to do it for story, because there is no constructor, so I cannot inject FormBuilder, and where can I call method like:
I just build
FormGroup
: