Revert "feat(upgrade): allow setting the angularjs lib at runtime (#15168)"
This reverts commit 8ad464d90e
.
Breaks G3.
This commit is contained in:
@ -201,7 +201,6 @@ function noNg() {
|
||||
throw new Error('AngularJS v1.x is not loaded!');
|
||||
}
|
||||
|
||||
|
||||
let angular: {
|
||||
bootstrap: (e: Element, modules: (string | IInjectable)[], config: IAngularBootstrapConfig) =>
|
||||
void,
|
||||
@ -209,62 +208,27 @@ let angular: {
|
||||
element: (e: Element | string) => IAugmentedJQuery,
|
||||
version: {major: number}, resumeBootstrap?: () => void,
|
||||
getTestability: (e: Element) => ITestabilityService
|
||||
} = <any>{
|
||||
bootstrap: noNg,
|
||||
module: noNg,
|
||||
element: noNg,
|
||||
version: noNg,
|
||||
resumeBootstrap: noNg,
|
||||
getTestability: noNg
|
||||
};
|
||||
|
||||
|
||||
try {
|
||||
if (window.hasOwnProperty('angular')) {
|
||||
setAngularLib((<any>window).angular);
|
||||
angular = (<any>window).angular;
|
||||
}
|
||||
} catch (e) {
|
||||
setAngularLib(<any>{
|
||||
bootstrap: noNg,
|
||||
module: noNg,
|
||||
element: noNg,
|
||||
version: noNg,
|
||||
resumeBootstrap: noNg,
|
||||
getTestability: noNg
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the AngularJS library.
|
||||
*
|
||||
* Used when angularjs is loaded lazily, and not available on `window`.
|
||||
*
|
||||
* @stable
|
||||
*/
|
||||
export function setAngularLib(ng: any): void {
|
||||
angular = ng;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current version of the AngularJS library.
|
||||
*
|
||||
* @stable
|
||||
*/
|
||||
export function getAngularLib(): any {
|
||||
return angular;
|
||||
}
|
||||
|
||||
export function bootstrap(
|
||||
e: Element, modules: (string | IInjectable)[], config: IAngularBootstrapConfig): void {
|
||||
angular.bootstrap(e, modules, config);
|
||||
}
|
||||
|
||||
export function module(prefix: string, dependencies?: string[]): IModule {
|
||||
return angular.module(prefix, dependencies);
|
||||
}
|
||||
|
||||
export function element(e: Element | string): IAugmentedJQuery {
|
||||
return angular.element(e);
|
||||
}
|
||||
|
||||
export function resumeBootstrap(): void {
|
||||
angular.resumeBootstrap();
|
||||
}
|
||||
|
||||
export function getTestability(e: Element): ITestabilityService {
|
||||
return angular.getTestability(e);
|
||||
// ignore in CJS mode.
|
||||
}
|
||||
|
||||
export const bootstrap = angular.bootstrap;
|
||||
export const module = angular.module;
|
||||
export const element = angular.element;
|
||||
export const version = angular.version;
|
||||
export const resumeBootstrap = angular.resumeBootstrap;
|
||||
export const getTestability = angular.getTestability;
|
||||
|
Reference in New Issue
Block a user