refactor(angular2/angular2_sfx): Allows no-module integration of Angular2
Translates angular2/angular2_sfx to TypeScript in order to allow Angular2 integration without modules.
This commit is contained in:
@ -1,20 +1,30 @@
|
|||||||
import * as angular from './angular2';
|
import * as ng from './angular2';
|
||||||
// the router should have its own SFX bundle
|
// the router should have its own SFX bundle
|
||||||
// But currently the module arithemtic 'angular2/router_sfx - angular2/angular2',
|
// But currently the module arithemtic 'angular2/router_sfx - angular2/angular2',
|
||||||
// is not support by system builder.
|
// is not support by system builder.
|
||||||
import * as router from './router';
|
import * as router from './router';
|
||||||
|
|
||||||
|
var angular: AngularOne = <any>ng;
|
||||||
|
(<AngularWindow>window).angular = angular;
|
||||||
|
|
||||||
|
var _prevAngular = (<AngularWindow>window).angular;
|
||||||
|
|
||||||
|
|
||||||
angular.router = router;
|
angular.router = router;
|
||||||
|
|
||||||
var _prevAngular = window.angular;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calling noConflict will restore window.angular to its pre-angular loading state
|
* Calling noConflict will restore window.angular to its pre-angular loading state
|
||||||
* and return the angular module object.
|
* and return the angular module object.
|
||||||
*/
|
*/
|
||||||
angular.noConflict = function() {
|
angular.noConflict = function() {
|
||||||
window.angular = _prevAngular;
|
(<AngularWindow>window).angular = _prevAngular;
|
||||||
return angular;
|
return angular;
|
||||||
};
|
};
|
||||||
|
|
||||||
window.angular = angular;
|
interface AngularOne {
|
||||||
|
router: any;
|
||||||
|
noConflict(): any;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AngularWindow extends Window {
|
||||||
|
angular: any;
|
||||||
|
}
|
Reference in New Issue
Block a user