forked from PatrickJS/angular-webpack-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.ts
More file actions
45 lines (41 loc) · 912 Bytes
/
dashboard.ts
File metadata and controls
45 lines (41 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/// <reference path="../../typings/_custom.d.ts" />
/*
* Angular 2
*/
import {Component, View, Directive, ElementRef} from 'angular2/angular2';
import {Renderer} from 'angular2/render';
/*
* TODO: refactor
* simple example directive that should be in `/directives` folder
*/
@Directive({
selector: '[x-large]' // using [ ] means selecting attributes
})
class XLarge {
constructor(element: ElementRef, renderer: Renderer) {
// simple DOM manipulation to set font size to x-large
renderer.setElementStyle(element, 'fontSize', 'x-large');
}
}
// Simple component with custom directive example
@Component({
selector: 'dashboard'
})
@View({
directives: [ XLarge ],
styles: [`
span[x-large] {
color: red;
}
`],
template: `
<div>
<h2>Dashboard</h2>
<span x-large>Extra Large Font Directive</span>
</div>
`
})
export class Dashboard {
constructor() {
}
}