Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

Commit 2acd8a6

Browse files
committed
feat(app.ts): include universal directive
1 parent bd7a83d commit 2acd8a6

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/app.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
1-
import {Component} from 'angular2/angular2';
1+
import {Component, Directive, ElementRef, Renderer} from 'angular2/angular2';
2+
3+
4+
@Directive({
5+
selector: '[x-large]'
6+
})
7+
class XLarge {
8+
constructor(element: ElementRef, renderer: Renderer) {
9+
// we must interact with the dom through Renderer for webworker/server to see the changes
10+
renderer.setElementStyle(element, 'fontSize', 'x-large');
11+
}
12+
}
13+
214

315
@Component({
416
selector: 'app',
17+
directives: [ XLarge ],
518
template: `
619
<div>
7-
<h1>Hello, {{ name }}!</h1>
20+
<div>
21+
<span x-large>Hello, {{ name }}!</span>
22+
</div>
23+
824
name: <input type="text" [value]="name" (input)="name = $event.target.value" autofocus>
925
</div>
1026
`

0 commit comments

Comments
 (0)