In one of our project, we have setup angular application and using jasmine for unit testing and protactor for End-to-End testing. We have been using DOM id's for identifying and querying elements across application. We have also been using CSS class as well. While I come from ExtJS background where it is recommended to use itemId v/s DOM Id as itemId is unique within the container. And so we can have same itemId within one DOM across different hierarchy and thus you can make your components reusable without much worry.
Is there any equivalent in Angular?
If not, I feel this is very common scenario that angular developers might have come across. What's the best way to identify elements in Angular so that code is maintainable over longer period?
Reference ExtJs recommended link:- Using Id and itemId in Extjs to access components
I have referred this link but it doesn't seem to be relevant for reusable components. For instance if I have my custom table.component and I give it Id as 'SomeTableId'. Then I cannot use table twice in my same DOM page.
Aucun commentaire:
Enregistrer un commentaire