fix(upgrade): replaces get/setAngularLib with get/setAngularJSGlobal
The current names are confusing because Angular should refer to the latest version of the framework.
This commit is contained in:
parent
82bcd83566
commit
057513536b
|
@ -243,22 +243,36 @@ try {
|
|||
}
|
||||
|
||||
/**
|
||||
* Resets the AngularJS library.
|
||||
* @deprecated Use {@link setAngularJSGlobal} instead.
|
||||
*/
|
||||
export function setAngularLib(ng: any): void {
|
||||
setAngularJSGlobal(ng);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link getAngularJSGlobal} instead.
|
||||
*/
|
||||
export function getAngularLib(): any {
|
||||
return getAngularJSGlobal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the AngularJS global.
|
||||
*
|
||||
* Used when angularjs is loaded lazily, and not available on `window`.
|
||||
* Used when AngularJS is loaded lazily, and not available on `window`.
|
||||
*
|
||||
* @stable
|
||||
*/
|
||||
export function setAngularLib(ng: any): void {
|
||||
export function setAngularJSGlobal(ng: any): void {
|
||||
angular = ng;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current version of the AngularJS library.
|
||||
* Returns the current AngularJS global.
|
||||
*
|
||||
* @stable
|
||||
*/
|
||||
export function getAngularLib(): any {
|
||||
export function getAngularJSGlobal(): any {
|
||||
return angular;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* Entry point for all public APIs of this package. allowing
|
||||
* Angular 1 and Angular 2+ to run side by side in the same application.
|
||||
*/
|
||||
export {getAngularLib, setAngularLib} from './src/common/angular1';
|
||||
export {getAngularJSGlobal, getAngularLib, setAngularJSGlobal, setAngularLib} from './src/common/angular1';
|
||||
export {downgradeComponent} from './src/common/downgrade_component';
|
||||
export {downgradeInjectable} from './src/common/downgrade_injectable';
|
||||
export {VERSION} from './src/common/version';
|
||||
|
@ -20,4 +20,5 @@ export {downgradeModule} from './src/static/downgrade_module';
|
|||
export {UpgradeComponent} from './src/static/upgrade_component';
|
||||
export {UpgradeModule} from './src/static/upgrade_module';
|
||||
|
||||
|
||||
// This file only re-exports content of the `src` folder. Keep it that way.
|
||||
|
|
|
@ -12,7 +12,7 @@ import {BrowserModule} from '@angular/platform-browser';
|
|||
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
||||
import * as angular from '@angular/upgrade/src/common/angular1';
|
||||
import {$INJECTOR, INJECTOR_KEY} from '@angular/upgrade/src/common/constants';
|
||||
import {UpgradeModule, downgradeInjectable, getAngularLib, setAngularLib} from '@angular/upgrade/static';
|
||||
import {UpgradeModule, downgradeInjectable, getAngularJSGlobal, setAngularJSGlobal} from '@angular/upgrade/static';
|
||||
|
||||
import {bootstrap, html} from '../test_helpers';
|
||||
|
||||
|
@ -103,9 +103,9 @@ export function main() {
|
|||
it('should allow resetting angular at runtime', async(() => {
|
||||
let wrappedBootstrapepedCalled = false;
|
||||
|
||||
const n: any = getAngularLib();
|
||||
const n: any = getAngularJSGlobal();
|
||||
|
||||
setAngularLib({
|
||||
setAngularJSGlobal({
|
||||
bootstrap: (...args: any[]) => {
|
||||
wrappedBootstrapepedCalled = true;
|
||||
n.bootstrap(...args);
|
||||
|
|
|
@ -14,9 +14,15 @@ export declare function downgradeInjectable(token: any): Function;
|
|||
export declare function downgradeModule<T>(moduleFactoryOrBootstrapFn: NgModuleFactory<T> | ((extraProviders: StaticProvider[]) => Promise<NgModuleRef<T>>)): string;
|
||||
|
||||
/** @stable */
|
||||
export declare function getAngularJSGlobal(): any;
|
||||
|
||||
/** @deprecated */
|
||||
export declare function getAngularLib(): any;
|
||||
|
||||
/** @stable */
|
||||
export declare function setAngularJSGlobal(ng: any): void;
|
||||
|
||||
/** @deprecated */
|
||||
export declare function setAngularLib(ng: any): void;
|
||||
|
||||
/** @experimental */
|
||||
|
|
Loading…
Reference in New Issue