X Tutup
Skip to content

Commit df877a7

Browse files
committed
fix(build): clang-format
1 parent 4572157 commit df877a7

File tree

2 files changed

+34
-58
lines changed

2 files changed

+34
-58
lines changed
Lines changed: 31 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import {NgIf, NgFor, EventEmitter, Component, View, Inject, Injectable} from 'angular2/angular2';
2-
import {RouterLink, RouteConfig, Router, RouterOutlet, Location, RouteParams} from 'angular2/router';
2+
import {
3+
RouterLink,
4+
RouteConfig,
5+
Router,
6+
RouterOutlet,
7+
Location,
8+
RouteParams
9+
} from 'angular2/router';
310
import {Http} from 'angular2/http';
411
import {ObservableWrapper, PromiseWrapper} from 'angular2/src/facade/async';
512

@@ -9,22 +16,19 @@ class DbService {
916

1017
getData() {
1118
return new Promise((resolve, reject) => {
12-
ObservableWrapper.subscribe(this.http.get('./db.json', { cache: true }), (resp) => {
13-
resolve(resp.json());
14-
});
19+
ObservableWrapper.subscribe(this.http.get('./db.json', {cache: true}),
20+
(resp) => { resolve(resp.json()); });
1521
});
1622
}
1723

1824
drafts() {
19-
return PromiseWrapper.then(this.getData(), (data) => {
20-
return data.filter(record => record.draft);
21-
});
25+
return PromiseWrapper.then(this.getData(),
26+
(data) => { return data.filter(record => record.draft); });
2227
}
2328

2429
emails() {
25-
return PromiseWrapper.then(this.getData(), (data) => {
26-
return data.filter(record => !record.draft);
27-
});
30+
return PromiseWrapper.then(this.getData(),
31+
(data) => { return data.filter(record => !record.draft); });
2832
}
2933

3034
email(id) {
@@ -39,13 +43,8 @@ class DbService {
3943
}
4044
}
4145

42-
@Component({
43-
selector: 'inbox-detail'
44-
})
45-
@View({
46-
templateUrl: "inbox-detail.html",
47-
directives: [NgFor, RouterLink]
48-
})
46+
@Component({selector: 'inbox-detail'})
47+
@View({templateUrl: "inbox-detail.html", directives: [NgFor, RouterLink]})
4948
class InboxDetailCmp {
5049
id: string;
5150
subject: string;
@@ -56,38 +55,29 @@ class InboxDetailCmp {
5655

5756
constructor(db: DbService, params: RouteParams) {
5857
var id = params.get('id');
59-
PromiseWrapper.then(db.email(id)).then((data) => {
60-
this.setEmailRecord(data);
61-
});
58+
PromiseWrapper.then(db.email(id)).then((data) => { this.setEmailRecord(data); });
6259
}
6360

64-
get fullName() {
65-
return this.firstName + ' ' + this.lastName;
66-
}
61+
get fullName() { return this.firstName + ' ' + this.lastName; }
6762

6863
setEmailRecord(record) {
69-
this.id = record['id'];
70-
this.subject = record['subject'];
71-
this.content = record['content'];
72-
this.email = record['email'];
64+
this.id = record['id'];
65+
this.subject = record['subject'];
66+
this.content = record['content'];
67+
this.email = record['email'];
7368
this.firstName = record['first-name'];
74-
this.lastName = record['last-name'];
75-
this.date = record['date'];
69+
this.lastName = record['last-name'];
70+
this.date = record['date'];
7671
}
7772
}
7873

7974
@Component({selector: 'inbox'})
80-
@View({
81-
templateUrl: "inbox.html",
82-
directives: [NgFor, RouterLink]
83-
})
75+
@View({templateUrl: "inbox.html", directives: [NgFor, RouterLink]})
8476
class InboxCmp {
8577
q: string;
8678
items: List = [];
8779
constructor(public router: Router, db: DbService) {
88-
PromiseWrapper.then(db.emails(), (emails) => {
89-
this.items = emails;
90-
});
80+
PromiseWrapper.then(db.emails(), (emails) => { this.items = emails; });
9181
}
9282
}
9383

@@ -97,21 +87,13 @@ class InboxCmp {
9787
class DraftsCmp {
9888
items: List = [];
9989
constructor(public router: Router, db: DbService) {
100-
PromiseWrapper.then(db.drafts(), (drafts) => {
101-
this.items = drafts;
102-
});
90+
PromiseWrapper.then(db.drafts(), (drafts) => { this.items = drafts; });
10391
}
10492
}
10593

10694

107-
@Component({
108-
selector: 'inbox-app',
109-
viewInjector: [DbService]
110-
})
111-
@View({
112-
templateUrl: "inbox-app.html",
113-
directives: [RouterOutlet, RouterLink]
114-
})
95+
@Component({selector: 'inbox-app', viewInjector: [DbService]})
96+
@View({templateUrl: "inbox-app.html", directives: [RouterOutlet, RouterLink]})
11597
@RouteConfig([
11698
{path: '/', component: InboxCmp, as: 'inbox'},
11799
{path: '/drafts', component: DraftsCmp, as: 'drafts'},
@@ -124,10 +106,6 @@ export class InboxApp {
124106
this.router = router;
125107
this.location = location;
126108
}
127-
inboxPageActive() {
128-
return this.location.path() == '';
129-
}
130-
draftsPageActive() {
131-
return this.location.path() == '/drafts';
132-
}
109+
inboxPageActive() { return this.location.path() == ''; }
110+
draftsPageActive() { return this.location.path() == '/drafts'; }
133111
}

modules/examples/src/routing/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import {routerInjectables, HashLocationStrategy, LocationStrategy} from 'angular
44
import {httpInjectables} from 'angular2/http';
55

66
export function main() {
7-
bootstrap(InboxApp, [
8-
routerInjectables,
9-
httpInjectables,
10-
bind(LocationStrategy).toClass(HashLocationStrategy)
11-
]);
7+
bootstrap(
8+
InboxApp,
9+
[routerInjectables, httpInjectables, bind(LocationStrategy).toClass(HashLocationStrategy)]);
1210
}

0 commit comments

Comments
 (0)
X Tutup