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:
parent
2b714df64e
commit
bae6b91e7d
|
@ -1,20 +1,30 @@
|
|||
import * as angular from './angular2';
|
||||
import * as ng from './angular2';
|
||||
// the router should have its own SFX bundle
|
||||
// But currently the module arithemtic 'angular2/router_sfx - angular2/angular2',
|
||||
// is not support by system builder.
|
||||
import * as router from './router';
|
||||
|
||||
var angular: AngularOne = <any>ng;
|
||||
(<AngularWindow>window).angular = angular;
|
||||
|
||||
var _prevAngular = (<AngularWindow>window).angular;
|
||||
|
||||
|
||||
angular.router = router;
|
||||
|
||||
var _prevAngular = window.angular;
|
||||
|
||||
/**
|
||||
* Calling noConflict will restore window.angular to its pre-angular loading state
|
||||
* and return the angular module object.
|
||||
*/
|
||||
angular.noConflict = function() {
|
||||
window.angular = _prevAngular;
|
||||
(<AngularWindow>window).angular = _prevAngular;
|
||||
return angular;
|
||||
};
|
||||
|
||||
window.angular = angular;
|
||||
interface AngularOne {
|
||||
router: any;
|
||||
noConflict(): any;
|
||||
}
|
||||
|
||||
interface AngularWindow extends Window {
|
||||
angular: any;
|
||||
}
|
Loading…
Reference in New Issue