Skip to content

Commit b9fe990

Browse files
committed
(#12) dashboard module
1 parent 8bb9424 commit b9fe990

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/// <reference path="../../../typings/_custom.d.ts" />
2+
3+
/*
4+
* Angular 2
5+
*/
6+
import {Component, View, Directive, ElementRef} from 'angular2/angular2';
7+
8+
let view = require('./views/dashboard.html');
9+
10+
/*
11+
* TODO: refactor
12+
* simple example directive that should be in `/directives` folder
13+
*/
14+
@Directive({
15+
selector: '[x-large]' // using [ ] means selecting attributes
16+
})
17+
class XLarge {
18+
constructor(public el: ElementRef) {
19+
// simple dom manipulation to set font size to x-large
20+
if (this.el.nativeElement.style) {
21+
this.el.nativeElement.style.fontSize = 'x-large';
22+
}
23+
}
24+
}
25+
26+
// Simple component with custom directive example
27+
@Component({
28+
selector: 'dashboard'
29+
})
30+
@View({
31+
directives: [ XLarge ],
32+
template: view
33+
})
34+
export class Dashboard {
35+
constructor() {
36+
37+
}
38+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<style>
2+
span[x-large] {
3+
color: red;
4+
}
5+
</style>
6+
<div>
7+
<h2>Dashboard</h2>
8+
<span x-large>Extra Large Font Directive</span>
9+
</div>

0 commit comments

Comments
 (0)