Skip to content

Commit a0dc12b

Browse files
JeanMechepkozlowski-opensource
authored andcommitted
refactor(core): deprecate the NgProbeToken (#51396)
DEPRECATED: NgProbeToken The `NgProbeToken` is not used internally since the transition from View Engine to Ivy. The token has no utility and can be removed from applications and libraries. PR Close #51396
1 parent f2513c5 commit a0dc12b

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

aio/content/guide/deprecations.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ v16 - v19
129129
|:--- |:--- |:--- |:--- |
130130
| `@angular/animations` | `AnimationDriver.NOOP` | v17 | v19 |
131131
| `@angular/core` | `PACKAGE_ROOT_URL` | v17 | v19 |
132+
| `@angular/core` | `NgProbeToken` | v17 | v19 |
132133

133134
### Deprecated features with no planned removal version
134135

@@ -193,6 +194,7 @@ In the [API reference section](api) of this site, deprecated APIs are indicated
193194
| [`providedIn: 'any'`](api/core/Injectable#providedIn) | none | v15 | This option has confusing semantics and nearly zero usage. |
194195
| [`EnvironmentInjector.runInContext`](api/core/EnvironmentInjector#runInContext) | `runInInjectionContext` | v16 | `runInInjectionContext` is a more flexible operation which supports element injectors as well |
195196
| [`@Component.moduleId`](api/core/Component#moduleId) | none | v16 |
197+
| [`NgProbeToken`](api/core/NgProbeToken) | none | v16 | `ng.prob` was replaced by `ng.getComponent` since Ivy
196198

197199

198200
<a id="testing"></a>

goldens/public-api/core/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ export abstract class NgModuleRef<T> {
10481048
abstract onDestroy(callback: () => void): void;
10491049
}
10501050

1051-
// @public
1051+
// @public @deprecated
10521052
export class NgProbeToken {
10531053
constructor(name: string, token: any);
10541054
// (undocumented)

packages/core/src/application_ref.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export function isBoundToModule<C>(cf: ComponentFactory<C>): boolean {
152152
/**
153153
* A token for third-party components that can register themselves with NgProbe.
154154
*
155+
* @deprecated
155156
* @publicApi
156157
*/
157158
export class NgProbeToken {

packages/router/src/router_module.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import {HashLocationStrategy, Location, LocationStrategy, PathLocationStrategy, ViewportScroller} from '@angular/common';
10-
import {APP_BOOTSTRAP_LISTENER, ComponentRef, inject, Inject, InjectionToken, ModuleWithProviders, NgModule, NgProbeToken, NgZone, Optional, Provider, SkipSelf, ɵRuntimeError as RuntimeError} from '@angular/core';
10+
import {APP_BOOTSTRAP_LISTENER, ComponentRef, inject, Inject, InjectionToken, ModuleWithProviders, NgModule, NgZone, Optional, Provider, SkipSelf, ɵRuntimeError as RuntimeError} from '@angular/core';
1111

1212
import {EmptyOutletComponent} from './components/empty_outlet';
1313
import {RouterLink} from './directives/router_link';
@@ -55,10 +55,6 @@ export const ROUTER_PROVIDERS: Provider[] = [
5555
[],
5656
];
5757

58-
export function routerNgProbeToken() {
59-
return new NgProbeToken('Router', Router);
60-
}
61-
6258
/**
6359
* @description
6460
*
@@ -123,7 +119,6 @@ export class RouterModule {
123119
config?.useHash ? provideHashLocationStrategy() : providePathLocationStrategy(),
124120
provideRouterScroller(),
125121
config?.preloadingStrategy ? withPreloading(config.preloadingStrategy).ɵproviders : [],
126-
{provide: NgProbeToken, multi: true, useFactory: routerNgProbeToken},
127122
config?.initialNavigation ? provideInitialNavigation(config) : [],
128123
config?.bindToComponentInputs ? withComponentInputBinding().ɵproviders : [],
129124
config?.enableViewTransitions ? withViewTransitions().ɵproviders : [],

0 commit comments

Comments
 (0)