From 0d330d0bcd5c7f1e2e09c544639cfa38ae358f17 Mon Sep 17 00:00:00 2001 From: Andrew Kushnir Date: Tue, 19 Apr 2022 18:50:47 -0700 Subject: [PATCH] refactor(common): expose `NgImage` directive via a private API (#47082) This commit exports experimental `NgImage` directive via a private API of the `@angular/common` package, so that it can be used acorss other Angular packages for testing purposes. PR Close #47082 --- packages/common/src/common.ts | 1 + packages/common/src/directives/ng_image.ts | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/common/src/common.ts b/packages/common/src/common.ts index c8579fb932a..586972414e6 100644 --- a/packages/common/src/common.ts +++ b/packages/common/src/common.ts @@ -27,3 +27,4 @@ export {PLATFORM_BROWSER_ID as ɵPLATFORM_BROWSER_ID, PLATFORM_SERVER_ID as ɵPL export {VERSION} from './version'; export {ViewportScroller, NullViewportScroller as ɵNullViewportScroller} from './viewport_scroller'; export {XhrFactory} from './xhr'; +export {NgImageModule as ɵNgImageModule, NgImage as ɵNgImage, IMAGE_LOADER as ɵIMAGE_LOADER} from './directives/ng_image'; diff --git a/packages/common/src/directives/ng_image.ts b/packages/common/src/directives/ng_image.ts index 8edaa6642b4..df2b2de2179 100644 --- a/packages/common/src/directives/ng_image.ts +++ b/packages/common/src/directives/ng_image.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {Directive, Inject, InjectionToken, Input, SimpleChanges, ɵRuntimeError as RuntimeError} from '@angular/core'; +import {Directive, Inject, InjectionToken, Input, NgModule, SimpleChanges, ɵRuntimeError as RuntimeError} from '@angular/core'; import {RuntimeErrorCode} from '../errors'; @@ -132,6 +132,17 @@ export class NgImage { } } +/** + * Temporary NgModule that exports the `NgImage` directive. + * The module should not be needed once the `standalone` flag is supported as a public API. + */ +@NgModule({ + declarations: [NgImage], + exports: [NgImage], +}) +export class NgImageModule { +} + /***** Helpers *****/ // Convert input value to integer.