Skip to content

Commit 48ba798

Browse files
committed
upgrade angular2 alpah46
1 parent 0591668 commit 48ba798

13 files changed

+38
-49
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
"homepage": "https://github.com/springboot-angular2-tutorial/angular2-app",
3131
"dependencies": {
3232
"@reactivex/rxjs": "5.0.0-alpha.7",
33-
"angular2": "2.0.0-alpha.44",
33+
"angular2": "2.0.0-alpha.46",
3434
"bootstrap": "^3.3.5",
3535
"jquery": "^2.1.4",
3636
"jwt-decode": "^1.4.0",
3737
"lodash": "^3.10.1",
3838
"md5-hex": "^1.1.0",
3939
"moment": "^2.10.6",
40-
"ng2-bootstrap": "https://github.com/akirasosa/ng2-bootstrap.git",
40+
"ng2-bootstrap": "0.46.0",
4141
"pluralize": "^1.2.1",
4242
"reflect-metadata": "0.1.2",
4343
"time-ago": "^0.1.0",

src/app/components/app/App.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,24 @@ require('!style!css!toastr/build/toastr.css');
2929
directives: [SecurityRouterOutlet, Header],
3030
})
3131
@RouteConfig([
32-
{path: '/home', as: 'Home', component: HomePage},
33-
{path: '/login', as: 'Login', component: LoginPage},
34-
{path: '/signup', as: 'Signup', component: SignupPage},
35-
{path: '/users', as: 'UserList', component: UserListPage},
36-
{path: '/users/:id', as: 'UserShow', component: UserShowPage},
37-
{path: '/users/me/edit', as: 'MeEdit', component: UserEditPage},
32+
{path: '/home', name: 'Home', component: HomePage},
33+
{path: '/login', name: 'Login', component: LoginPage},
34+
{path: '/signup', name: 'Signup', component: SignupPage},
35+
{path: '/users', name: 'UserList', component: UserListPage},
36+
{path: '/users/:id', name: 'UserShow', component: UserShowPage},
37+
{path: '/users/me/edit', name: 'MeEdit', component: UserEditPage},
3838
{
3939
path: '/users/:id/followings',
40-
as: 'FollowingList',
40+
name: 'FollowingList',
4141
component: FollowingListPage
4242
},
4343
{
4444
path: '/users/:id/followers',
45-
as: 'FollowerList',
45+
name: 'FollowerList',
4646
component: FollowerListPage
4747
},
48-
{path: '/help', as: 'Help', component: HelpPage},
49-
{path: '/', as: 'Top', component: TopPage},
48+
{path: '/help', name: 'Help', component: HelpPage},
49+
{path: '/', name: 'Top', component: TopPage},
5050
])
5151
export class App {
5252
}

src/app/components/home/Feed.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
iit,
1717
} from 'angular2/testing';
1818
import {DOM} from 'angular2/src/core/dom/dom_adapter';
19-
import {ObservableWrapper} from "angular2/src/core/facade/async";
19+
import {ObservableWrapper} from "angular2/src/facade/async";
2020
import {Router, Location, RouterOutlet} from 'angular2/router';
2121
import {ResponseOptions, Response} from 'angular2/http';
2222

src/app/components/home/Feed.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {Gravatar} from 'app/components'
2323
export class Feed {
2424

2525
feed:Micropost[];
26-
deleted:EventEmitter = new EventEmitter();
26+
deleted:EventEmitter<any> = new EventEmitter();
2727

2828
constructor(private micropostService:MicropostService,
2929
private feedService:FeedService,
@@ -44,7 +44,7 @@ export class Feed {
4444
this.micropostService.delete(id)
4545
.subscribe(() => {
4646
this.list();
47-
this.deleted.next(null);
47+
this.deleted.next({});
4848
}, e => this.errorHandler.handle(e))
4949
;
5050
}

src/app/components/micropost/MicropostList.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
import {DOM} from 'angular2/src/core/dom/dom_adapter';
1717
import {ResponseOptions, Response} from 'angular2/http';
1818
import {RouteParams} from 'angular2/router';
19-
import {ObservableWrapper} from "angular2/src/core/facade/async";
19+
import {ObservableWrapper} from "angular2/src/facade/async";
2020

2121
import {Pagination} from "ng2-bootstrap/components/pagination/pagination";
2222

src/app/components/micropost/MicropostNew.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from 'angular2/testing';
1616
import {DOM} from 'angular2/src/core/dom/dom_adapter';
1717
import {ResponseOptions, Response, BaseResponseOptions} from 'angular2/http';
18-
import {ObservableWrapper} from "angular2/src/core/facade/async";
18+
import {ObservableWrapper} from "angular2/src/facade/async";
1919

2020
import {MicropostNew} from 'app/components';
2121
import {APP_TEST_PROVIDERS} from "app/bindings";

src/app/components/micropost/MicropostNew.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const toastr = require('toastr');
1414
})
1515
export class MicropostNew {
1616

17-
created:EventEmitter = new EventEmitter();
17+
created:EventEmitter<any> = new EventEmitter();
1818

1919
constructor(private micropostService:MicropostService,
2020
private errorHandler:ErrorHandler) {
@@ -30,7 +30,7 @@ export class MicropostNew {
3030
.subscribe(() => {
3131
toastr.success('Micropost created!');
3232
content.value = '';
33-
this.created.next(null);
33+
this.created.next({});
3434
}, e => this.errorHandler.handle(e))
3535
;
3636
}

src/app/components/relationship/FollowBtn.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from 'angular2/testing';
1616
import {DOM} from 'angular2/src/core/dom/dom_adapter';
1717
import {ResponseOptions, Response, BaseResponseOptions} from 'angular2/http';
18-
import {ObservableWrapper} from "angular2/src/core/facade/async";
18+
import {ObservableWrapper} from "angular2/src/facade/async";
1919

2020
import {FollowBtn} from 'app/components';
2121
import {APP_TEST_PROVIDERS} from "app/bindings";

src/app/components/relationship/UserList.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
import {DOM} from 'angular2/src/core/dom/dom_adapter';
1717
import {ResponseOptions, Response} from 'angular2/http';
1818
import {RouteParams} from 'angular2/router';
19-
import {ObservableWrapper} from "angular2/src/core/facade/async";
19+
import {ObservableWrapper} from "angular2/src/facade/async";
2020

2121
import {Pagination} from "ng2-bootstrap/components/pagination/pagination";
2222

src/app/components/user-stats/UserStats.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
import {DOM} from 'angular2/src/core/dom/dom_adapter';
1717
import {ResponseOptions, Response} from 'angular2/http';
1818
import {RouteParams} from 'angular2/router';
19-
import {ObservableWrapper} from "angular2/src/core/facade/async";
19+
import {ObservableWrapper} from "angular2/src/facade/async";
2020

2121
import {UserStats, Gravatar} from "app/components";
2222
import {APP_TEST_PROVIDERS} from "app/bindings";

src/app/components/user/UserEditPage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class UserEditPage {
7676
}
7777

7878
onSubmit(value) {
79-
this.passwordConfirmation.updateValidity({});
79+
this.passwordConfirmation.updateValueAndValidity({});
8080
this.passwordConfirmation.markAsTouched();
8181
if (!this.myForm.valid) return;
8282
this.userService.updateMe(_.omit(value, _.isEmpty))

src/app/http/xhr_backend.ts

+12-23
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* Original XHRBackend does not parse response headers.
33
* So, I added parsing process on original one.
44
*/
5-
import {Injectable} from 'angular2/angular2';
6-
import {isPresent} from 'angular2/src/core/facade/lang';
5+
import {Injectable, Observable} from 'angular2/angular2';
6+
import {isPresent} from 'angular2/src/facade/lang';
77
import {
88
ConnectionBackend,
99
Connection,
@@ -18,9 +18,6 @@ import {
1818
BrowserXhr,
1919
} from 'angular2/http';
2020

21-
// todo(robwormald): temporary until https://github.com/angular/angular/issues/4390 decided
22-
var Rx = require('@reactivex/rxjs/dist/cjs/Rx');
23-
var {Observable} = Rx;
2421
/**
2522
* Creates connections using `XMLHttpRequest`. Given a fully-qualified
2623
* request, an `XHRConnection` will immediately create an `XMLHttpRequest` object and send the
@@ -30,18 +27,17 @@ var {Observable} = Rx;
3027
* the {@link MockConnection} may be interacted with in tests.
3128
*/
3229
export class XHRConnection implements Connection {
33-
request:Request;
30+
request: Request;
3431
/**
3532
* Response {@link EventEmitter} which emits a single {@link Response} value on load event of
3633
* `XMLHttpRequest`.
3734
*/
38-
response:any; // TODO: Make generic of <Response>;
39-
readyState:ReadyStates;
40-
41-
constructor(req:Request, browserXHR:BrowserXhr, baseResponseOptions?:ResponseOptions) {
35+
response: Observable<Response>;
36+
readyState: ReadyStates;
37+
constructor(req: Request, browserXHR: BrowserXhr, baseResponseOptions?: ResponseOptions) {
4238
this.request = req;
4339
this.response = new Observable(responseObserver => {
44-
let _xhr:XMLHttpRequest = browserXHR.build();
40+
let _xhr: XMLHttpRequest = browserXHR.build();
4541
_xhr.open(RequestMethods[req.method].toUpperCase(), req.url);
4642
// load event handler
4743
let onLoad = () => {
@@ -73,10 +69,7 @@ export class XHRConnection implements Connection {
7369
};
7470
// error event handler
7571
let onError = (err) => {
76-
var responseOptions = new ResponseOptions({
77-
body: err,
78-
type: ResponseTypes.Error
79-
});
72+
var responseOptions = new ResponseOptions({body: err, type: ResponseTypes.Error});
8073
if (isPresent(baseResponseOptions)) {
8174
responseOptions = baseResponseOptions.merge(responseOptions);
8275
}
@@ -98,7 +91,6 @@ export class XHRConnection implements Connection {
9891
_xhr.abort();
9992
};
10093
});
101-
10294
}
10395

10496
private parseHeaders(xhr) {
@@ -120,7 +112,7 @@ export class XHRConnection implements Connection {
120112
* overridden if a different backend implementation should be used,
121113
* such as in a node backend.
122114
*
123-
* #Example
115+
* ### Example
124116
*
125117
* ```
126118
* import {Http, MyNodeBackend, HTTP_PROVIDERS, BaseRequestOptions} from 'angular2/http';
@@ -133,19 +125,16 @@ export class XHRConnection implements Connection {
133125
* })
134126
* class MyComponent {
135127
* constructor(http:Http) {
136-
* http('people.json').subscribe(res => this.people = res.json());
128+
* http.request('people.json').subscribe(res => this.people = res.json());
137129
* }
138130
* }
139131
* ```
140132
*
141133
**/
142134
@Injectable()
143135
export class XHRBackend implements ConnectionBackend {
144-
constructor(private _browserXHR:BrowserXhr, private _baseResponseOptions:ResponseOptions) {
145-
}
146-
147-
createConnection(request:Request):XHRConnection {
136+
constructor(private _browserXHR: BrowserXhr, private _baseResponseOptions: ResponseOptions) {}
137+
createConnection(request: Request): XHRConnection {
148138
return new XHRConnection(request, this._browserXHR, this._baseResponseOptions);
149139
}
150140
}
151-

src/app/routes/SecurityRouterOutlet.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ class LoginPage {
112112
directives: [SecurityRouterOutlet],
113113
})
114114
@RouteConfig([
115-
{path: '/private', as: 'PrivateCmp', component: PrivateCmp},
116-
{path: '/public', as: 'PublicCmp', component: PublicCmp},
117-
{path: '/login', as: 'Login', component: LoginPage},
115+
{path: '/private', name: 'PrivateCmp', component: PrivateCmp},
116+
{path: '/public', name: 'PublicCmp', component: PublicCmp},
117+
{path: '/login', name: 'Login', component: LoginPage},
118118
])
119119
class TestCmp {
120120
}

0 commit comments

Comments
 (0)