Skip to content

Commit baa299b

Browse files
committed
Merge pull request #13 from opiepj/feature/12-dashboard
Feature/12 dashboard
2 parents 8bb9424 + 83f3c79 commit baa299b

File tree

9 files changed

+260
-212
lines changed

9 files changed

+260
-212
lines changed

src/app/components/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {appPipes} from '../pipes/pipes';
2727
// We use a folder if we want separate files
2828
import {Home} from './home/home';
2929
// Otherwise we only use one file for a component
30-
import {Dashboard} from './dashboard';
30+
import {Dashboard} from './dashboard/dashboard';
3131

3232
// Example modules
3333
import {ExampleModules} from './example-modules/example-modules';
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>
Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
/// <reference path="../../../typings/_custom.d.ts" />
2-
3-
// Angular 2
4-
import {Component, View, CSSClass} from 'angular2/angular2';
5-
import {RouteConfig, routerDirectives} from 'angular2/router';
6-
// Modules
7-
import {Tictactoe} from './tictactoe-module/tictactoe';
8-
// View
9-
let template = require('./example-modules.html');
10-
let styles = require('./example-modules.css')
11-
@Component({
12-
selector: 'example-modules'
13-
})
14-
@RouteConfig([
15-
{ path: '/', redirectTo: '/search' },
16-
{ path: '/search', as: 'search', component: Search },
17-
{ path: '/tictactoe', as: 'tictactoe', component: Tictactoe }
18-
])
19-
@View({
20-
directives: [ routerDirectives, CSSClass ],
21-
// include our .css file
22-
styles: [ styles ], // Use webpack's `require` to get files as a raw string using raw-loader
23-
template: template
24-
})
25-
export class ExampleModules {
26-
active: number = 0;
27-
}
1+
/// <reference path="../../../typings/_custom.d.ts" />
2+
3+
// Angular 2
4+
import {Component, View, CSSClass} from 'angular2/angular2';
5+
import {RouteConfig, routerDirectives} from 'angular2/router';
6+
// Modules
7+
import {Tictactoe} from './tictactoe-module/tictactoe';
8+
import {Search} from '.search-module/search';
9+
// View
10+
let template = require('./example-modules.html');
11+
let styles = require('./example-modules.css')
12+
@Component({
13+
selector: 'example-modules'
14+
})
15+
@RouteConfig([
16+
{ path: '/', redirectTo: '/search' },
17+
{ path: '/search', as: 'search', component: Search },
18+
{ path: '/tictactoe', as: 'tictactoe', component: Tictactoe }
19+
])
20+
@View({
21+
directives: [ routerDirectives, CSSClass ],
22+
// include our .css file
23+
styles: [ styles ], // Use webpack's `require` to get files as a raw string using raw-loader
24+
template: template
25+
})
26+
export class ExampleModules {
27+
active: number = 0;
28+
}

src/app/components/example-modules/search-module/directives/autosuggest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// <reference path="../../../../typings/_custom.d.ts" />
1+
/// <reference path="../../../../../typings/_custom.d.ts" />
22

33
// Angular 2
44
import {Directive, View, EventEmitter, ElementRef, LifecycleEvent} from 'angular2/angular2';

src/app/components/example-modules/search-module/services/github.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// <reference path="../../../../typings/_custom.d.ts" />
1+
/// <reference path="../../../../../typings/_custom.d.ts" />
22

33
import {bind, Injectable, Http} from 'angular2/angular2'
44

src/app/components/example-modules/search-module/services/searchable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// <reference path="../../../../typings/_custom.d.ts" />
1+
/// <reference path="../../../../../typings/_custom.d.ts" />
22

33
export interface ISearchable<T> {
44
search(query: string): Rx.Observable<string[]>;

0 commit comments

Comments
 (0)