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:
@ -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
|
* @stable
|
||||||
*/
|
*/
|
||||||
export function setAngularLib(ng: any): void {
|
export function setAngularJSGlobal(ng: any): void {
|
||||||
angular = ng;
|
angular = ng;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current version of the AngularJS library.
|
* Returns the current AngularJS global.
|
||||||
*
|
*
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export function getAngularLib(): any {
|
export function getAngularJSGlobal(): any {
|
||||||
return angular;
|
return angular;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* Entry point for all public APIs of this package. allowing
|
* Entry point for all public APIs of this package. allowing
|
||||||
* Angular 1 and Angular 2+ to run side by side in the same application.
|
* 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 {downgradeComponent} from './src/common/downgrade_component';
|
||||||
export {downgradeInjectable} from './src/common/downgrade_injectable';
|
export {downgradeInjectable} from './src/common/downgrade_injectable';
|
||||||
export {VERSION} from './src/common/version';
|
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 {UpgradeComponent} from './src/static/upgrade_component';
|
||||||
export {UpgradeModule} from './src/static/upgrade_module';
|
export {UpgradeModule} from './src/static/upgrade_module';
|
||||||
|
|
||||||
|
|
||||||
// This file only re-exports content of the `src` folder. Keep it that way.
|
// 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 {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
||||||
import * as angular from '@angular/upgrade/src/common/angular1';
|
import * as angular from '@angular/upgrade/src/common/angular1';
|
||||||
import {$INJECTOR, INJECTOR_KEY} from '@angular/upgrade/src/common/constants';
|
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';
|
import {bootstrap, html} from '../test_helpers';
|
||||||
|
|
||||||
@ -103,9 +103,9 @@ export function main() {
|
|||||||
it('should allow resetting angular at runtime', async(() => {
|
it('should allow resetting angular at runtime', async(() => {
|
||||||
let wrappedBootstrapepedCalled = false;
|
let wrappedBootstrapepedCalled = false;
|
||||||
|
|
||||||
const n: any = getAngularLib();
|
const n: any = getAngularJSGlobal();
|
||||||
|
|
||||||
setAngularLib({
|
setAngularJSGlobal({
|
||||||
bootstrap: (...args: any[]) => {
|
bootstrap: (...args: any[]) => {
|
||||||
wrappedBootstrapepedCalled = true;
|
wrappedBootstrapepedCalled = true;
|
||||||
n.bootstrap(...args);
|
n.bootstrap(...args);
|
||||||
|
6
tools/public_api_guard/upgrade/static.d.ts
vendored
6
tools/public_api_guard/upgrade/static.d.ts
vendored
@ -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;
|
export declare function downgradeModule<T>(moduleFactoryOrBootstrapFn: NgModuleFactory<T> | ((extraProviders: StaticProvider[]) => Promise<NgModuleRef<T>>)): string;
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
|
export declare function getAngularJSGlobal(): any;
|
||||||
|
|
||||||
|
/** @deprecated */
|
||||||
export declare function getAngularLib(): any;
|
export declare function getAngularLib(): any;
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
|
export declare function setAngularJSGlobal(ng: any): void;
|
||||||
|
|
||||||
|
/** @deprecated */
|
||||||
export declare function setAngularLib(ng: any): void;
|
export declare function setAngularLib(ng: any): void;
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
|
Reference in New Issue
Block a user