In this lecture, let's learn how to add a directive to a component or an HTML element based on a given condition. If the condition assigned to directive returns true then apply that directive on that HTML element. But if it returns false, then do not apply that directive to the HTML element or component on which it is used.
To learn how to implement this kind of logic, let's say we have a list of cards in the webpage. Now, we have a highlight directive which we want to apply only to that card which has the highest number of likes. This directive should not be applied on any other cards. Let's se how to achieve this.
Learn about spread operator: https://youtu.be/nrw5Xo3VbJE
Learn about Sorting an array: https://youtu.be/TaBSdB_Btx0
Project Code: https://drive.google.com/file/d/16SYON13Ld1xWVjGlMNXplSYT110qE868/view?usp=sharing