Here is the code that I have
<parent my-directive [toHide]="childRef">
<child bottom right #childRef>
<button>Some text </button>
</child >
</parent >
Here I have my-directive
on the parent element and I want to access the child and apply some style to it.
So in my directive, I have the following.
export class MyDirective {
@Input("toHide") localRef;
constructor(public element:ElementRef,public renderer:Renderer) {
console.log('Hello MyDirective Directive');
}
ngAfterViewInit() {
console.log("All Transtition set");
console.log(this.localRef);
this.renderer.setElementStyle(this.localRef, 'webkitTransition', 'transform 500ms,top 500ms');
}
As you can see that I am using this.renderer
to set the style on the element but I get the following.
ERROR Error: Uncaught (in promise): TypeError: el.style is undefined
Any help in this regard is appritiated.