feat(build): record angular version in the dom (#13164)
This commit is contained in:

committed by
Alex Rickabaugh

parent
3e73bea3e7
commit
e628b66cca
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import {CommonModule, PlatformLocation} from '@angular/common';
|
||||
import {ApplicationModule, ErrorHandler, NgModule, Optional, PLATFORM_INITIALIZER, PlatformRef, Provider, RootRenderer, Sanitizer, SkipSelf, Testability, createPlatformFactory, platformCore} from '@angular/core';
|
||||
import {ApplicationModule, ErrorHandler, NgModule, Optional, PLATFORM_INITIALIZER, PlatformRef, Provider, RootRenderer, Sanitizer, SkipSelf, Testability, VERSION, createPlatformFactory, platformCore} from '@angular/core';
|
||||
|
||||
import {AnimationDriver} from '../src/dom/animation_driver';
|
||||
import {WebAnimationsDriver} from '../src/dom/web_animations_driver';
|
||||
@ -29,6 +29,7 @@ import {DomSanitizer, DomSanitizerImpl} from './security/dom_sanitization_servic
|
||||
|
||||
export const INTERNAL_BROWSER_PLATFORM_PROVIDERS: Provider[] = [
|
||||
{provide: PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true},
|
||||
{provide: PLATFORM_INITIALIZER, useValue: recordAngularVersion, multi: true},
|
||||
{provide: PlatformLocation, useClass: BrowserPlatformLocation}
|
||||
];
|
||||
|
||||
@ -54,6 +55,14 @@ export function initDomAdapter() {
|
||||
BrowserGetTestability.init();
|
||||
}
|
||||
|
||||
export function recordAngularVersion(): void {
|
||||
const domAdapter = getDOM();
|
||||
const body = domAdapter.getElementsByTagName(domAdapter.defaultDoc(), 'body');
|
||||
if (body.length > 0) {
|
||||
domAdapter.setAttribute(body[0], 'ng-version', VERSION.full);
|
||||
}
|
||||
}
|
||||
|
||||
export function errorHandler(): ErrorHandler {
|
||||
return new ErrorHandler();
|
||||
}
|
||||
|
@ -16,5 +16,4 @@ export {DOCUMENT} from './dom/dom_tokens';
|
||||
export {EVENT_MANAGER_PLUGINS, EventManager} from './dom/events/event_manager';
|
||||
export {HAMMER_GESTURE_CONFIG, HammerGestureConfig} from './dom/events/hammer_gestures';
|
||||
export {DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl} from './security/dom_sanitization_service';
|
||||
|
||||
export * from './private_export';
|
||||
export * from './private_export';
|
Reference in New Issue
Block a user