You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 341fadd
Browse filesBrowse the repository at this point in the historyBrowse files
docs: fix inaccurate statements and broken examples across adev
Fix code examples that don't compile or fail at runtime, wrong API
names, and statements of defaults or behavior that no longer match the
source, across the forms, signals, http, routing, DI, components,
testing, CLI, reference, ecosystem and tutorial pages.
Copy file name to clipboardExpand all lines: adev/src/content/best-practices/runtime-performance/skipping-subtrees.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Change detection is sufficiently fast for most applications. However, when an ap
8
8
9
9
OnPush is the default change detection strategy in Angular (since v22). It instructs Angular to run change detection for a component subtree **only** when:
10
10
11
-
- The root component of the subtree receives new inputs as the result of a template binding. Angular compares the current and past value of the input with `==`.
11
+
- The root component of the subtree receives new inputs as the result of a template binding. Angular compares the current and past value of the input with `Object.is`.
12
12
- Angular handles an event _(for example using event binding, output binding, or `@HostListener` )_ in the subtree's root component or any of its children whether they are using OnPush change detection or not.
Copy file name to clipboardExpand all lines: adev/src/content/ecosystem/rxjs-interop/signals-interop.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -128,7 +128,7 @@ Here, only the last value (3) will be logged.
128
128
129
129
## Using `rxResource` for async data
130
130
131
-
Angular's [`resource` function](/guide/signals/resource) gives you a way to incorporate async data into your application's signal-based code. Building on top of this pattern, `rxResource` lets you define a resource where the source of your data is defined in terms of an RxJS `Observable`. Instead of accepting a `loader` function, `rxResource` accepts a `stream` function that accepts an RxJS `Observable`.
131
+
Angular's [`resource` function](/guide/signals/resource) gives you a way to incorporate async data into your application's signal-based code. Building on top of this pattern, `rxResource` lets you define a resource where the source of your data is defined in terms of an RxJS `Observable`. Instead of accepting a `loader` function, `rxResource` accepts a `stream` function that returns an RxJS `Observable`.
|`VersionDetectedEvent`| Emitted when the service worker has detected a new version of the app on the server and is about to start downloading it. |
22
-
|`NoNewVersionDetectedEvent`| Emitted when the service worker has checked the version of the app on the server and did not find a new version. |
23
-
|`VersionReadyEvent`| Emitted when a new version of the app is available to be activated by clients. It may be used to notify the user of an available update or prompt them to refresh the page. |
24
-
|`VersionInstallationFailedEvent`| Emitted when the installation of a new version failed. It may be used for logging/monitoring purposes. |
25
-
|`VersionFailedEvent`| Emitted when a version encounters a critical failure (such as broken hash errors) that affects all clients using that version. Provides error details for debugging and transparency. |
17
+
The `versionUpdates` is an `Observable` property of `SwUpdate` and emits four event types:
|`VersionDetectedEvent`| Emitted when the service worker has detected a new version of the app on the server and is about to start downloading it. |
22
+
|`NoNewVersionDetectedEvent`| Emitted when the service worker has checked the version of the app on the server and did not find a new version. |
23
+
|`VersionReadyEvent`| Emitted when a new version of the app is available to be activated by clients. It may be used to notify the user of an available update or prompt them to refresh the page. |
24
+
|`VersionInstallationFailedEvent`| Emitted when the installation of a new version failed. It may be used for logging/monitoring purposes. |
Copy file name to clipboardExpand all lines: adev/src/content/guide/components/queries.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,7 +102,7 @@ export class UserProfile {}
102
102
103
103
If the query does not find a result, its value is `undefined`. This may occur if the target element is absent or hidden by `@if`. Angular keeps the result of `contentChild` up to date as your application state changes.
104
104
105
-
By default, content queries find only _direct_ children of the component and do not traverse into descendants.
105
+
By default, `contentChild` queries traverse into descendants, while `contentChildren` queries find only _direct_ children. See [Content descendants](#content-descendants).
106
106
107
107
You can also query for multiple results with the `contentChildren` function.
Copy file name to clipboardExpand all lines: adev/src/content/guide/di/debugging-and-troubleshooting-di.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -135,7 +135,7 @@ Each component gets its own `UserClient` instance. Changes in one component don'
135
135
**Solution:** Use `@Service` for singletons.
136
136
137
137
```ts {prefer, header: 'Root-level singleton'}
138
-
import {Injectable} from'@angular/core';
138
+
import {Service} from'@angular/core';
139
139
140
140
@Service()
141
141
exportclassUserClient {
@@ -250,7 +250,7 @@ export class UserProfile {
250
250
Use `runInInjectionContext()` when you need to enable **other code** to call `inject()`. This is useful when accepting callbacks that might use dependency injection:
251
251
252
252
```angular-ts
253
-
import {Component, inject, Injector, input} from '@angular/core';
253
+
import {Component, inject, Injector, input, runInInjectionContext} from '@angular/core';
254
254
255
255
@Component({
256
256
selector: 'app-data-loader',
@@ -264,13 +264,13 @@ export class DataLoader {
264
264
const callback = this.onLoad();
265
265
if (callback) {
266
266
// Enable the callback to use inject()
267
-
this.injector.runInInjectionContext(callback);
267
+
runInInjectionContext(this.injector, callback);
268
268
}
269
269
}
270
270
}
271
271
```
272
272
273
-
The `runInInjectionContext()`method creates a temporary injection context, allowing code inside the callback to call `inject()`.
273
+
The `runInInjectionContext()`function creates a temporary injection context, allowing code inside the callback to call `inject()`.
274
274
275
275
IMPORTANT: Always capture dependencies at the class level when possible. Use `injector.get()` for simple deferred retrieval, and `runInInjectionContext()` only when external code needs to call `inject()`.
276
276
@@ -671,7 +671,7 @@ This section provides detailed information about specific Angular DI error codes
671
671
672
672
### NullInjectorError: No provider for [Service]
673
673
674
-
**Error code:**None (displayed as `NullInjectorError`)
674
+
**Error code:**[NG0201](errors/NG0201)
675
675
676
676
This error occurs when Angular cannot find a provider for a token in the injector hierarchy. The error message includes a dependency path showing where the injection was attempted.
677
677
@@ -855,12 +855,12 @@ Angular allows `inject()` in these locations:
855
855
})
856
856
export class UserProfile {
857
857
private userService: UserClient;
858
+
user: ReturnType<UserClient['getUser']>;
858
859
859
860
constructor() {
860
861
this.userService = inject(UserClient); // Valid
862
+
this.user = this.userService.getUser();
861
863
}
862
-
863
-
user = this.userService.getUser();
864
864
}
865
865
```
866
866
@@ -882,7 +882,7 @@ Angular allows `inject()` in these locations:
882
882
4.**Inside runInInjectionContext()**
883
883
884
884
```angular-ts
885
-
import {Component, inject, Injector} from '@angular/core';
885
+
import {Component, inject, Injector, runInInjectionContext} from '@angular/core';
886
886
import {UserClient} from './user-client';
887
887
888
888
@Component({
@@ -893,7 +893,7 @@ Angular allows `inject()` in these locations:
893
893
private injector = inject(Injector);
894
894
895
895
loadUser() {
896
-
this.injector.runInInjectionContext(() => {
896
+
runInInjectionContext(this.injector, () => {
897
897
const userService = inject(UserClient); // Valid
898
898
console.log(userService.getUser());
899
899
});
@@ -934,7 +934,7 @@ private userService = inject(UserClient) // Capture at class level
0 commit comments