Skip to content

Commit bae6b91

Browse files
committed
refactor(angular2/angular2_sfx): Allows no-module integration of Angular2
Translates angular2/angular2_sfx to TypeScript in order to allow Angular2 integration without modules.
1 parent 2b714df commit bae6b91

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed
Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
1-
import * as angular from './angular2';
1+
import * as ng from './angular2';
22
// the router should have its own SFX bundle
33
// But currently the module arithemtic 'angular2/router_sfx - angular2/angular2',
44
// is not support by system builder.
55
import * as router from './router';
66

7-
angular.router = router;
7+
var angular: AngularOne = <any>ng;
8+
(<AngularWindow>window).angular = angular;
9+
10+
var _prevAngular = (<AngularWindow>window).angular;
811

9-
var _prevAngular = window.angular;
1012

13+
angular.router = router;
1114
/**
1215
* Calling noConflict will restore window.angular to its pre-angular loading state
1316
* and return the angular module object.
1417
*/
1518
angular.noConflict = function() {
16-
window.angular = _prevAngular;
19+
(<AngularWindow>window).angular = _prevAngular;
1720
return angular;
1821
};
1922

20-
window.angular = angular;
23+
interface AngularOne {
24+
router: any;
25+
noConflict(): any;
26+
}
27+
28+
interface AngularWindow extends Window {
29+
angular: any;
30+
}

0 commit comments

Comments
 (0)