0

How to feed content to a component based on a link click

So, I am learning angular and I'm having a tough time understanding what exactly I should be learning to solve my problem. I'm building a personal website for my UX/UI designer friend, and he has a large porfolio. I have a long list of his portfolio on a single page, where I'm using "ngContent" to feed each "project box" with a background of the companies logo and a short description of his work with that company. What I want now is for each "project box" to link to the specific project gallery, basically a more in-depth view of his work at this specific company. My instinct, is to set up a component and feed the content into it based on the "project box" the user clicks. Problem is, even with google, I can't figure out exactly how I should go about doing that.

11th Dec 2022, 1:21 PM
snowlife
2 odpowiedzi
0
I think the root cause of this is pre mature development. Besides that, I think you should think in terms of components, a projects container component for listing child components(project). Please do some more reading about angular.
11th Dec 2022, 6:11 PM
Kirabo Ibrahim
Kirabo Ibrahim - avatar
0
"I think the root cause of this is pre mature development." - I memorize small details better when I'm trying to do something that's way too challenging. I don't remember step by step tutorials by next day, I know it's annoying, but you gotta do what you gotta do. "Besides that, I think you should think in terms of components, a projects container component for listing child components(project)." - that is chinese to me, but it helped me find something to work on, so I do I appreciate it. So far, I've figured out a possible way maybe, can i use "ngSwitch" to feed the data to my Component. All I would need to do is create a variable that changes based on the link I click. So if I have 3 project boxes with a "read more" button, if you click the first link, the variable would change into, let's say "1" and there would be a ngSwitch ready to add the correct content to the component based on that variable. Should I try making it work this way, is this good practice, or am I still off.
13th Dec 2022, 3:22 PM
snowlife