Relative Content

Tag Archive for angulartypescriptangular-directive

Angular – How to use directives conditionally?

I have a button component that displays one of two buttons depending on a config. The problem that I am having is that one of the buttons has a directive. That directive is being applied to BOTH buttons even though I have an if/else. Is there a way so that only one of the buttons has the directive applied and not the other?

Standalone Angular directive with @Input does not work

I am facing this weird issue with Angular directive for some reason which I could not figure out. I created a new Angular app, (cli v16.2.14). Where I have created two directives one that is described in this Angular tutorial and that works just fine. Now I have created another directive and put the same functionality as the previous one and performed everything as it is like the first one but this time it complains. Which I found weird. Below are my code sample –