refactor: export angular as ‘ng’ in SFX

This commit is contained in:
Misko Hevery 2015-07-02 19:43:16 +02:00 committed by Alex Eagle
parent 0e945e465d
commit 65a767d9b0
1 changed files with 6 additions and 16 deletions

View File

@ -4,27 +4,17 @@ import * as ng from './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; var _prevNg = (<any>window).ng;
(<AngularWindow>window).angular = angular;
var _prevAngular = (<AngularWindow>window).angular; (<any>window).ng = ng;
angular.router = router; (<any>ng).router = router;
/** /**
* 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() { (<any>ng).noConflict = function() {
(<AngularWindow>window).angular = _prevAngular; (<any>window).ng = _prevNg;
return angular; return ng;
}; };
interface AngularOne {
router: any;
noConflict(): any;
}
interface AngularWindow extends Window {
angular: any;
}