I am trying to create a structural directive that will change the parent structure of the DOM invoked using its selector (static) or by calling its public method (dynamic).
my-directive.ts
@Directive({ selector: '[sampleDirective]' })
export class SampleDirective {
...
constructor(..) {
this.customDirective();
}
}
customDirective() {
console.log('Inside customDirective()');
}
my-component.ts
import { SampleDirective } from './my.directive';
...
@Component({
selector: 'my-component',
template: `<button (click)="click()"> Click Me </button>`
})
constructor() { }
..
click() {
}
I need this because I am creating a general solution for changing the structure of the DOM component at runtime using the directive.
** Please ignore if there is a typo. sorry i couldn't paste the full code here