Search only in component

I have created a component, that I use multiple times on a page. I have also @input in these component, that will update some things in this component.

Is it possibel to search inside the component by id or something else, to find a specific element only inside this component. for instead document.getElementbyId(‘bla’) mycomponent,getElementbyId(‘bla’)

Best regards, anna

You’re almost always using Angular wrong if your code includes calls to document. To the maximum extent possible, talk to Angular and have Angular talk to the DOM. Probably the solution you want is something like: create a Map<componentName, inputs>, so you can keep track of inputs by componentName in your ts file. Then you add to the Map whenever you create a new component, and you can search through component 5’s inputs whenever you need to,by using key 5 with the Map.

Can you describe the larger picture of what you’re trying to achieve? There has absolutely got to be a more idiomatic way of going about whatever it is.

I am probably wrong. I want something similar to a usercontrol. In, c# I create the control for all my needs and reference one or many of them and have full control over each control and that content.

So if I get for example an @Input or anyway else an value, I want manipulate content of this specific instance of my component: That can be a simple text or a bunch of manipulation on a svg or what ever,.

So for example svg of all my used components will become part of the dom, but I want not search the dom, I want reference a instance of my component and then make my doings without influence the other instance of my component…

This is related to my question get content of ion-card.

Clearly this is not c# or and I am completly new to this web stuff and maybe I see not the right implementation pattern.

Best regards, anna

I would suggest taking the time to go through the Tour of Heroes in order to get more of a feel for how Angular apps are structured.