good explanations! just wondering how would you make a reusable component that you can pass through what’s inside the component and pass things like options. e.g a button component that has 2 preset styles based on if it is a “primary” or “secondary” button, with this how would you bind the on click event of this reusable component to a function on the parent component? really enjoying your angular videos as hope to see more!
@codewithbubb10 ай бұрын
Thanks again Fraser! Yeah, basically you'd make a component with an @Input decorator and and an @Output. You can pass in configuration info (like text, colour in your button example) and then fire off events from the component through the @Output to the parent. You could also use a directive if it was just for styling a button, but that's a different story! I was planning to do a components specific tutorial but I bumped it for some templating stuff but i'll try and rattle through recording some of the videos tonight so I can show you what I mean by the above 😀