How to pass object args #17723
Replies: 3 comments 5 replies
-
This worked for me
|
Beta Was this translation helpful? Give feedback.
-
I have my Angular flavor setup and behaving the exact same way as @thais-molica. Any resolution? |
Beta Was this translation helpful? Give feedback.
-
I couldn't get any of these solutions to work for me however it looks like Storybook has now made it easier. I'm not sure what version it was introduced in but upgrade this package to:
You will now have access to the new function https://storybook.js.org/docs/essentials/controls#fully-custom-args Here's an example where I needed to pass data to the ng-content in the component. All the arguments will be assigned to the component:
|
Beta Was this translation helpful? Give feedback.
-
I'm using angular 12 with storybook 6, in a nrwl workspace.
I have a component that receive an Array of objects as an argument. I was able to preset this argument using
args
, but when I pass it to my template it gives me an error:The only way I have to pass this arg to my component is as a string, witch breaks my ngFor loop. Is there an especific way of passing complex objects with storybook essentials?
Here is my args configuration:
And here is my template story:
If I pass the arg like that, I get that parsing error. If I pass like this (as a string)
<is-file-list files="${args.files}"></is-file-list>
, it breaks my component as it is expecting an Array.Beta Was this translation helpful? Give feedback.
All reactions