1
|
import { Component, Directive, ElementRef, Renderer, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
|
2
|
|
3
|
//
|
4
|
/////////////////////////
|
5
|
// ** Example Directive
|
6
|
// Notice we don't touch the Element directly
|
7
|
|
8
|
@Directive({
|
9
|
selector: '[xLarge]'
|
10
|
})
|
11
|
export class XLargeDirective {
|
12
|
constructor(element: ElementRef, renderer: Renderer) {
|
13
|
// ** IMPORTANT **
|
14
|
// we must interact with the dom through -Renderer-
|
15
|
// for webworker/server to see the changes
|
16
|
renderer.setElementStyle(element.nativeElement, 'fontSize', 'x-large');
|
17
|
// ^^
|
18
|
}
|
19
|
}
|
20
|
|
21
|
@Component({
|
22
|
changeDetection: ChangeDetectionStrategy.Default,
|
23
|
encapsulation: ViewEncapsulation.Emulated,
|
24
|
selector: 'app',
|
25
|
styles: [`
|
26
|
`],
|
27
|
template: `
|
28
|
<div>
|
29
|
<navbar></navbar>
|
30
|
<login></login>
|
31
|
<main>
|
32
|
<router-outlet></router-outlet>
|
33
|
</main>
|
34
|
</div>`
|
35
|
})
|
36
|
export class AppComponent {
|
37
|
title = 'ftw';
|
38
|
}
|