How do I add an attribute to an element when it is created ?
I tried the following Dashboard component:
import { Component, ElementRef, Renderer } from '@angular/core';
@Component({
selector: '[re-dashboard]',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.scss']
})
export class DashboardComponent {
constructor (private _el: ElementRef, private _renderer: Renderer) {
_renderer.setElementAttribute(_el, 're-component','');
}
}
I would like to add re-component attribute to the div when the DashboardComponent is being created. I then use re-component to style the created div. However I get the following error: http://pastebin.com/up35zmUv
Any ideas
Best regards