@anglr/select 17.2.0 → 18.0.0-beta.20260805043138

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/.claude/skills/angular-developer/SKILL.md +130 -130
  2. package/.claude/skills/angular-developer/references/angular-animations.md +160 -160
  3. package/.claude/skills/angular-developer/references/angular-aria.md +410 -410
  4. package/.claude/skills/angular-developer/references/cli.md +86 -86
  5. package/.claude/skills/angular-developer/references/component-harnesses.md +59 -59
  6. package/.claude/skills/angular-developer/references/component-styling.md +91 -91
  7. package/.claude/skills/angular-developer/references/components.md +117 -117
  8. package/.claude/skills/angular-developer/references/creating-services.md +97 -97
  9. package/.claude/skills/angular-developer/references/data-resolvers.md +69 -69
  10. package/.claude/skills/angular-developer/references/define-routes.md +67 -67
  11. package/.claude/skills/angular-developer/references/defining-providers.md +72 -72
  12. package/.claude/skills/angular-developer/references/di-fundamentals.md +120 -120
  13. package/.claude/skills/angular-developer/references/e2e-testing.md +66 -66
  14. package/.claude/skills/angular-developer/references/effects.md +83 -83
  15. package/.claude/skills/angular-developer/references/hierarchical-injectors.md +43 -43
  16. package/.claude/skills/angular-developer/references/host-elements.md +80 -80
  17. package/.claude/skills/angular-developer/references/injection-context.md +63 -63
  18. package/.claude/skills/angular-developer/references/inputs.md +101 -101
  19. package/.claude/skills/angular-developer/references/linked-signal.md +59 -59
  20. package/.claude/skills/angular-developer/references/loading-strategies.md +61 -61
  21. package/.claude/skills/angular-developer/references/mcp.md +106 -106
  22. package/.claude/skills/angular-developer/references/migrations.md +30 -30
  23. package/.claude/skills/angular-developer/references/navigate-to-routes.md +69 -69
  24. package/.claude/skills/angular-developer/references/outputs.md +86 -86
  25. package/.claude/skills/angular-developer/references/reactive-forms.md +122 -122
  26. package/.claude/skills/angular-developer/references/rendering-strategies.md +44 -44
  27. package/.claude/skills/angular-developer/references/resource.md +77 -77
  28. package/.claude/skills/angular-developer/references/route-animations.md +56 -56
  29. package/.claude/skills/angular-developer/references/route-guards.md +52 -52
  30. package/.claude/skills/angular-developer/references/router-lifecycle.md +45 -45
  31. package/.claude/skills/angular-developer/references/router-testing.md +87 -87
  32. package/.claude/skills/angular-developer/references/show-routes-with-outlets.md +68 -68
  33. package/.claude/skills/angular-developer/references/signal-forms.md +897 -897
  34. package/.claude/skills/angular-developer/references/signals-overview.md +94 -94
  35. package/.claude/skills/angular-developer/references/tailwind-css.md +69 -69
  36. package/.claude/skills/angular-developer/references/template-driven-forms.md +114 -114
  37. package/.claude/skills/angular-developer/references/testing-fundamentals.md +66 -66
  38. package/.github/instructions/typescript/code-conventions.md +7 -7
  39. package/.github/instructions/typescript/comments.md +40 -40
  40. package/.github/instructions/typescript/formatting.md +41 -41
  41. package/.github/instructions/typescript/naming-conventions.md +6 -6
  42. package/es2022/extensions/src/extensions/getSearch.js.map +1 -1
  43. package/es2022/extensions/src/extensions/getSelectedOption.js.map +1 -1
  44. package/es2022/extensions/src/extensions/getSelectedOptions.js.map +1 -1
  45. package/es2022/extensions/src/extensions/getValue.js.map +1 -1
  46. package/es2022/extensions/src/extensions/setReadonly.js.map +1 -1
  47. package/es2022/extensions/src/extensions/setValue.js.map +1 -1
  48. package/es2022/extensions/src/index.js.map +1 -1
  49. package/es2022/src/components/index.js.map +1 -1
  50. package/es2022/src/components/option/option.component.js.map +1 -1
  51. package/es2022/src/components/optionGroup/optgroup.component.js.map +1 -1
  52. package/es2022/src/components/select/select.component.js +2 -2
  53. package/es2022/src/components/select/select.component.js.map +1 -1
  54. package/es2022/src/decorators/index.js.map +1 -1
  55. package/es2022/src/decorators/mergeOptionsAsSignal/mergeOptionsAsSignal.decorator.js.map +1 -1
  56. package/es2022/src/directives/highlightInstance/highlightInstance.directive.js.map +1 -1
  57. package/es2022/src/directives/highlightSearch/highlightSearch.directive.js.map +1 -1
  58. package/es2022/src/directives/highlightText/highlightText.directive.js.map +1 -1
  59. package/es2022/src/directives/index.js.map +1 -1
  60. package/es2022/src/directives/normalStateTagTemplate/normalStateTagTemplate.directive.js.map +1 -1
  61. package/es2022/src/directives/normalStateTemplate/normalStateTemplate.directive.js.map +1 -1
  62. package/es2022/src/directives/optionGroupTemplate/optionGroupTemplate.directive.js.map +1 -1
  63. package/es2022/src/directives/optionTemplate/optionTemplate.directive.js.map +1 -1
  64. package/es2022/src/directives/selectAbsolute/selectAbsolute.directive.js.map +1 -1
  65. package/es2022/src/directives/selectControlValueAccessor/selectControlValueAccessor.directive.js.map +1 -1
  66. package/es2022/src/directives/selectEdit/selectEdit.directive.js.map +1 -1
  67. package/es2022/src/directives/selectFormControl/selectFormControl.directive.js.map +1 -1
  68. package/es2022/src/directives/selectMultipleKeepPopup/selectMultipleKeepPopup.directive.js.map +1 -1
  69. package/es2022/src/directives/selectNoCarret/selectNoCarret.directive.js.map +1 -1
  70. package/es2022/src/directives/selectPlaceholder/selectPlaceholder.directive.js.map +1 -1
  71. package/es2022/src/directives/withDirectAccess/withDirectAccess.directive.js.map +1 -1
  72. package/es2022/src/index.js.map +1 -1
  73. package/es2022/src/interfaces/index.js.map +1 -1
  74. package/es2022/src/interfaces/initState/initState.interface.js.map +1 -1
  75. package/es2022/src/interfaces/keyboardAction/keyboardAction.interface.js.map +1 -1
  76. package/es2022/src/interfaces/normalStateContext/normalStateContext.interface.js.map +1 -1
  77. package/es2022/src/interfaces/normalStateTagContext/normalStateTagContext.interface.js.map +1 -1
  78. package/es2022/src/interfaces/optionsGatherer/optionsGatherer.interface.js.map +1 -1
  79. package/es2022/src/interfaces/pluginDescription/pluginDescription.interface.js.map +1 -1
  80. package/es2022/src/interfaces/pluginOptions/pluginOptions.interface.js.map +1 -1
  81. package/es2022/src/interfaces/plugins/index.js.map +1 -1
  82. package/es2022/src/interfaces/plugins/interactions/interactions.interface.js.map +1 -1
  83. package/es2022/src/interfaces/plugins/keyboardHandler/keyboardHandler.interface.js.map +1 -1
  84. package/es2022/src/interfaces/plugins/keyboardHandler/simpleKeyboardHandler.interface.js.map +1 -1
  85. package/es2022/src/interfaces/plugins/liveSearch/editLiveSearch.interface.js.map +1 -1
  86. package/es2022/src/interfaces/plugins/liveSearch/filterLiveSearch.interface.js.map +1 -1
  87. package/es2022/src/interfaces/plugins/liveSearch/liveSearch.interface.js.map +1 -1
  88. package/es2022/src/interfaces/plugins/normalState/editNormalState.interface.js.map +1 -1
  89. package/es2022/src/interfaces/plugins/normalState/normalState.interface.js.map +1 -1
  90. package/es2022/src/interfaces/plugins/normalState/simpleNormalState.interface.js.map +1 -1
  91. package/es2022/src/interfaces/plugins/optionsHandler/optionsHandler.interface.js.map +1 -1
  92. package/es2022/src/interfaces/plugins/optionsHandler/simpleOptionsHandler.interface.js.map +1 -1
  93. package/es2022/src/interfaces/plugins/popup/popup.interface.js.map +1 -1
  94. package/es2022/src/interfaces/plugins/popup/simplePopup.interface.js.map +1 -1
  95. package/es2022/src/interfaces/plugins/positioner/commonPositioner.interface.js.map +1 -1
  96. package/es2022/src/interfaces/plugins/positioner/popoverPositioner.interface.js.map +1 -1
  97. package/es2022/src/interfaces/plugins/positioner/positioner.interface.js.map +1 -1
  98. package/es2022/src/interfaces/plugins/readonlyState/readonlyState.interface.js.map +1 -1
  99. package/es2022/src/interfaces/plugins/valueHandler/dynamicValueHandler.interface.js.map +1 -1
  100. package/es2022/src/interfaces/plugins/valueHandler/valueHandler.interface.js.map +1 -1
  101. package/es2022/src/interfaces/popupContext/popupContext.interface.js.map +1 -1
  102. package/es2022/src/interfaces/selectApi/selectApi.interface.js.map +1 -1
  103. package/es2022/src/interfaces/selectBusOptions/selectBusOptions.interface.js.map +1 -1
  104. package/es2022/src/interfaces/selectCssClasses/selectCssClasses.interface.js.map +1 -1
  105. package/es2022/src/interfaces/selectEvent/selectEvent.interface.js.map +1 -1
  106. package/es2022/src/interfaces/selectEvents/selectEvents.interface.js.map +1 -1
  107. package/es2022/src/interfaces/selectOption/selectOption.interface.js.map +1 -1
  108. package/es2022/src/interfaces/selectOptionGroup/selectOptionGroup.interface.js.map +1 -1
  109. package/es2022/src/interfaces/selectOptionState/selectOptionState.interface.js.map +1 -1
  110. package/es2022/src/interfaces/selectOptionStateSyntetic/selectOptionStateSyntetic.interface.js.map +1 -1
  111. package/es2022/src/interfaces/selectOptions/selectOptions.interface.js.map +1 -1
  112. package/es2022/src/interfaces/selectPlugin/selectPlugin.interface.js.map +1 -1
  113. package/es2022/src/interfaces/selectPluginTypes/selectPluginTypes.interface.js.map +1 -1
  114. package/es2022/src/interfaces/tempValue/tempValue.interface.js.map +1 -1
  115. package/es2022/src/interfaces/templateGatherer/templateGatherer.interface.js.map +1 -1
  116. package/es2022/src/interfaces/visualPluginOptions/visualPluginOptions.interface.js.map +1 -1
  117. package/es2022/src/misc/classes/codeOptionsGatherer/codeOptionsGatherer.interface.js.map +1 -1
  118. package/es2022/src/misc/classes/index.js.map +1 -1
  119. package/es2022/src/misc/classes/selectBus/selectBus.js.map +1 -1
  120. package/es2022/src/misc/classes/selectPluginInstances/selectPluginInstances.js.map +1 -1
  121. package/es2022/src/misc/enums.js.map +1 -1
  122. package/es2022/src/misc/providers.js.map +1 -1
  123. package/es2022/src/misc/tokens.js.map +1 -1
  124. package/es2022/src/misc/types.js.map +1 -1
  125. package/es2022/src/misc/utils.js.map +1 -1
  126. package/es2022/src/modules/index.js.map +1 -1
  127. package/es2022/src/modules/select.module.js.map +1 -1
  128. package/es2022/src/pipes/addNewOption/addNewOption.pipe.js.map +1 -1
  129. package/es2022/src/pipes/displayOptionValue/displayOptionValue.pipe.js.map +1 -1
  130. package/es2022/src/pipes/displayValue/displayValue.pipe.js.map +1 -1
  131. package/es2022/src/pipes/getPlugin/getPlugin.pipe.js.map +1 -1
  132. package/es2022/src/pipes/groupedListOptions/groupedListOptions.pipe.js.map +1 -1
  133. package/es2022/src/pipes/hasValue/hasValue.pipe.js.map +1 -1
  134. package/es2022/src/pipes/index.js.map +1 -1
  135. package/es2022/src/pipes/optionCssClasses/optionCssClasses.pipe.js.map +1 -1
  136. package/es2022/src/plugins/index.js.map +1 -1
  137. package/es2022/src/plugins/interactions/index.js.map +1 -1
  138. package/es2022/src/plugins/interactions/simpleInteractions/simpleInteractions.component.js.map +1 -1
  139. package/es2022/src/plugins/keyboardHandler/index.js.map +1 -1
  140. package/es2022/src/plugins/keyboardHandler/simpleKeyboardHandler/simpleKeyboardHandler.component.js.map +1 -1
  141. package/es2022/src/plugins/liveSearch/editLiveSearch/editLiveSearch.component.js +2 -2
  142. package/es2022/src/plugins/liveSearch/editLiveSearch/editLiveSearch.component.js.map +1 -1
  143. package/es2022/src/plugins/liveSearch/filterLiveSearch/filterLiveSearch.component.js.map +1 -1
  144. package/es2022/src/plugins/liveSearch/index.js.map +1 -1
  145. package/es2022/src/plugins/liveSearch/noLiveSearch/noLiveSearch.component.js.map +1 -1
  146. package/es2022/src/plugins/normalState/editNormalState/editNormalState.component.js +2 -2
  147. package/es2022/src/plugins/normalState/editNormalState/editNormalState.component.js.map +1 -1
  148. package/es2022/src/plugins/normalState/index.js.map +1 -1
  149. package/es2022/src/plugins/normalState/simpleNormalState/simpleNormalState.component.js +5 -6
  150. package/es2022/src/plugins/normalState/simpleNormalState/simpleNormalState.component.js.map +1 -1
  151. package/es2022/src/plugins/optionsHandler/index.js.map +1 -1
  152. package/es2022/src/plugins/optionsHandler/noOptionsHandler/noOptionsHandler.component.js.map +1 -1
  153. package/es2022/src/plugins/optionsHandler/optionsHandlerBase.js.map +1 -1
  154. package/es2022/src/plugins/optionsHandler/simpleOptionsHandler/simpleOptionsHandler.component.js.map +1 -1
  155. package/es2022/src/plugins/popup/index.js.map +1 -1
  156. package/es2022/src/plugins/popup/simplePopup/simplePopup.component.js +2 -2
  157. package/es2022/src/plugins/popup/simplePopup/simplePopup.component.js.map +1 -1
  158. package/es2022/src/plugins/positioner/commonPositioner/commonPositioner.component.js.map +1 -1
  159. package/es2022/src/plugins/positioner/index.js.map +1 -1
  160. package/es2022/src/plugins/positioner/noPositioner/noPositioner.component.js.map +1 -1
  161. package/es2022/src/plugins/positioner/popoverPositioner/popoverPositioner.component.js.map +1 -1
  162. package/es2022/src/plugins/valueHandler/dynamicValueHandler/dynamicValueHandler.component.js.map +1 -1
  163. package/es2022/src/plugins/valueHandler/index.js.map +1 -1
  164. package/es2022/src/plugins/valueHandler/staticValueHandler/staticValueHandler.component.js.map +1 -1
  165. package/package.json +125 -125
  166. package/src/components/select/select.component.css +5 -5
  167. package/src/interfaces/plugins/normalState/simpleNormalState.interface.d.ts +1 -5
  168. package/src/interfaces/plugins/normalState/simpleNormalState.interface.d.ts.map +1 -1
  169. package/src/plugins/liveSearch/editLiveSearch/editLiveSearch.component.html +19 -19
  170. package/src/plugins/normalState/editNormalState/editNormalState.component.html +50 -50
  171. package/src/plugins/normalState/simpleNormalState/simpleNormalState.component.d.ts.map +1 -1
  172. package/src/plugins/normalState/simpleNormalState/simpleNormalState.component.html +36 -37
  173. package/src/plugins/popup/simplePopup/simplePopup.component.html +56 -56
  174. package/styles/components/_liveSearch.scss +32 -32
  175. package/styles/components/_normalState.scss +116 -116
  176. package/styles/components/_popup.scss +107 -107
  177. package/styles/components/_select.scss +14 -14
  178. package/styles/core/_defaultTheme.scss +105 -105
  179. package/styles/core/_misc.scss +34 -34
  180. package/styles/core/_mixins.scss +29 -29
  181. package/styles/index.scss +2 -2
  182. package/styles/themes/dark.scss +63 -63
  183. package/styles/themes/light.scss +64 -64
  184. package/version.bak +1 -1
@@ -1,44 +1,44 @@
1
- # Rendering Strategies
2
-
3
- Angular supports multiple rendering strategies to optimize for SEO, performance, and interactivity.
4
-
5
- ## 1. Client-Side Rendering (CSR)
6
-
7
- **Default Strategy.** Content is rendered entirely in the browser.
8
-
9
- - **Use case**: Interactive dashboards, internal tools.
10
- - **Pros**: Simplest to configure, low server cost.
11
- - **Cons**: Poor SEO, slower initial content visibility (must wait for JS).
12
-
13
- ## 2. Static Site Generation (SSG / Prerendering)
14
-
15
- Content is pre-rendered into static HTML files at **build time**.
16
-
17
- - **Use case**: Marketing pages, blogs, documentation.
18
- - **Pros**: Fastest initial load, excellent SEO, CDN-friendly.
19
- - **Cons**: Requires rebuild for content updates, not for user-specific data.
20
-
21
- ## 3. Server-Side Rendering (SSR)
22
-
23
- Content is rendered on the server for the **initial request**. Subsequent navigations happen client-side (SPA style).
24
-
25
- - **Use case**: E-commerce product pages, news sites, personalized dynamic content.
26
- - **Pros**: Excellent SEO, fast initial content visibility.
27
- - **Cons**: Requires a server (Node.js), higher server cost/latency.
28
-
29
- ## Hydration
30
-
31
- Hydration is the process of making server-rendered HTML interactive in the browser.
32
-
33
- - **Full Hydration**: The entire app becomes interactive at once.
34
- - **Incremental Hydration**: (Advanced) Parts become interactive as needed using `@defer` blocks.
35
- - **Event Replay**: Captures and replays user events that happened before hydration finished.
36
-
37
- ## Decision Matrix
38
-
39
- | Requirement | Strategy |
40
- | :------------------------------ | :------------------- |
41
- | **SEO + Static Content** | SSG |
42
- | **SEO + Dynamic Content** | SSR |
43
- | **No SEO + High Interactivity** | CSR |
44
- | **Mixed** | Hybrid (Route-based) |
1
+ # Rendering Strategies
2
+
3
+ Angular supports multiple rendering strategies to optimize for SEO, performance, and interactivity.
4
+
5
+ ## 1. Client-Side Rendering (CSR)
6
+
7
+ **Default Strategy.** Content is rendered entirely in the browser.
8
+
9
+ - **Use case**: Interactive dashboards, internal tools.
10
+ - **Pros**: Simplest to configure, low server cost.
11
+ - **Cons**: Poor SEO, slower initial content visibility (must wait for JS).
12
+
13
+ ## 2. Static Site Generation (SSG / Prerendering)
14
+
15
+ Content is pre-rendered into static HTML files at **build time**.
16
+
17
+ - **Use case**: Marketing pages, blogs, documentation.
18
+ - **Pros**: Fastest initial load, excellent SEO, CDN-friendly.
19
+ - **Cons**: Requires rebuild for content updates, not for user-specific data.
20
+
21
+ ## 3. Server-Side Rendering (SSR)
22
+
23
+ Content is rendered on the server for the **initial request**. Subsequent navigations happen client-side (SPA style).
24
+
25
+ - **Use case**: E-commerce product pages, news sites, personalized dynamic content.
26
+ - **Pros**: Excellent SEO, fast initial content visibility.
27
+ - **Cons**: Requires a server (Node.js), higher server cost/latency.
28
+
29
+ ## Hydration
30
+
31
+ Hydration is the process of making server-rendered HTML interactive in the browser.
32
+
33
+ - **Full Hydration**: The entire app becomes interactive at once.
34
+ - **Incremental Hydration**: (Advanced) Parts become interactive as needed using `@defer` blocks.
35
+ - **Event Replay**: Captures and replays user events that happened before hydration finished.
36
+
37
+ ## Decision Matrix
38
+
39
+ | Requirement | Strategy |
40
+ | :------------------------------ | :------------------- |
41
+ | **SEO + Static Content** | SSG |
42
+ | **SEO + Dynamic Content** | SSR |
43
+ | **No SEO + High Interactivity** | CSR |
44
+ | **Mixed** | Hybrid (Route-based) |
@@ -1,77 +1,77 @@
1
- # Async Reactivity with `resource`
2
-
3
- > [!IMPORTANT]
4
- > The `resource` API is currently experimental in Angular.
5
-
6
- A `Resource` incorporates asynchronous data fetching into Angular's signal-based reactivity. It executes an async loader function whenever its dependencies change, exposing the status and result as synchronous signals.
7
-
8
- ## Basic Usage
9
-
10
- The `resource` function accepts an options object with two main properties:
11
-
12
- 1. `params`: A reactive computation (like `computed`). When signals read here change, the resource re-fetches.
13
- 2. `loader`: An async function that fetches data based on the parameters.
14
-
15
- ```ts
16
- import { Component, resource, signal, computed } from '@angular/core';
17
-
18
- @Component({...})
19
- export class UserProfile {
20
- userId = signal('123');
21
-
22
- userResource = resource({
23
- // Reactively tracking userId
24
- params: () => ({ id: this.userId() }),
25
-
26
- // Executes whenever params change
27
- loader: async ({ params, abortSignal }) => {
28
- const response = await fetch(`/api/users/${params.id}`, { signal: abortSignal });
29
- if (!response.ok) throw new Error('Network error');
30
- return response.json();
31
- }
32
- });
33
-
34
- // Use the resource value in computed signals
35
- userName = computed(() => {
36
- if (this.userResource.hasValue()) {
37
- return this.userResource.value()?.name;
38
- } else {
39
- return 'Loading...';
40
- }
41
- });
42
- }
43
- ```
44
-
45
- ## Aborting Requests
46
-
47
- If the `params` signal changes while a previous loader is still running, the `Resource` will attempt to abort the outstanding request using the provided `abortSignal`. **Always pass `abortSignal` to your `fetch` calls.**
48
-
49
- ## Reloading Data
50
-
51
- You can imperatively force the resource to re-run the loader without the params changing by calling `.reload()`.
52
-
53
- ```ts
54
- this.userResource.reload();
55
- ```
56
-
57
- ## Resource Status Signals
58
-
59
- The `Resource` object provides several signals to read its current state:
60
-
61
- - `value()`: The resolved data, or `undefined`.
62
- - `hasValue()`: Type-guard boolean. `true` if a value exists.
63
- - `isLoading()`: Boolean indicating if the loader is currently running.
64
- - `error()`: The error thrown by the loader, or `undefined`.
65
- - `status()`: A string constant representing the exact state (`'idle'`, `'loading'`, `'resolved'`, `'error'`, `'reloading'`, `'local'`).
66
-
67
- ## Local Mutation
68
-
69
- You can optimistically update the resource's value directly. This changes the status to `'local'`.
70
-
71
- ```ts
72
- this.userResource.value.set({name: 'Optimistic Update'});
73
- ```
74
-
75
- ## Reactive Data Fetching with `httpResource`
76
-
77
- If you are using Angular's `HttpClient`, prefer using `httpResource`. It is a specialized wrapper that leverages the Angular HTTP stack (including interceptors) while providing the same signal-based resource API.
1
+ # Async Reactivity with `resource`
2
+
3
+ > [!IMPORTANT]
4
+ > The `resource` API is currently experimental in Angular.
5
+
6
+ A `Resource` incorporates asynchronous data fetching into Angular's signal-based reactivity. It executes an async loader function whenever its dependencies change, exposing the status and result as synchronous signals.
7
+
8
+ ## Basic Usage
9
+
10
+ The `resource` function accepts an options object with two main properties:
11
+
12
+ 1. `params`: A reactive computation (like `computed`). When signals read here change, the resource re-fetches.
13
+ 2. `loader`: An async function that fetches data based on the parameters.
14
+
15
+ ```ts
16
+ import { Component, resource, signal, computed } from '@angular/core';
17
+
18
+ @Component({...})
19
+ export class UserProfile {
20
+ userId = signal('123');
21
+
22
+ userResource = resource({
23
+ // Reactively tracking userId
24
+ params: () => ({ id: this.userId() }),
25
+
26
+ // Executes whenever params change
27
+ loader: async ({ params, abortSignal }) => {
28
+ const response = await fetch(`/api/users/${params.id}`, { signal: abortSignal });
29
+ if (!response.ok) throw new Error('Network error');
30
+ return response.json();
31
+ }
32
+ });
33
+
34
+ // Use the resource value in computed signals
35
+ userName = computed(() => {
36
+ if (this.userResource.hasValue()) {
37
+ return this.userResource.value()?.name;
38
+ } else {
39
+ return 'Loading...';
40
+ }
41
+ });
42
+ }
43
+ ```
44
+
45
+ ## Aborting Requests
46
+
47
+ If the `params` signal changes while a previous loader is still running, the `Resource` will attempt to abort the outstanding request using the provided `abortSignal`. **Always pass `abortSignal` to your `fetch` calls.**
48
+
49
+ ## Reloading Data
50
+
51
+ You can imperatively force the resource to re-run the loader without the params changing by calling `.reload()`.
52
+
53
+ ```ts
54
+ this.userResource.reload();
55
+ ```
56
+
57
+ ## Resource Status Signals
58
+
59
+ The `Resource` object provides several signals to read its current state:
60
+
61
+ - `value()`: The resolved data, or `undefined`.
62
+ - `hasValue()`: Type-guard boolean. `true` if a value exists.
63
+ - `isLoading()`: Boolean indicating if the loader is currently running.
64
+ - `error()`: The error thrown by the loader, or `undefined`.
65
+ - `status()`: A string constant representing the exact state (`'idle'`, `'loading'`, `'resolved'`, `'error'`, `'reloading'`, `'local'`).
66
+
67
+ ## Local Mutation
68
+
69
+ You can optimistically update the resource's value directly. This changes the status to `'local'`.
70
+
71
+ ```ts
72
+ this.userResource.value.set({name: 'Optimistic Update'});
73
+ ```
74
+
75
+ ## Reactive Data Fetching with `httpResource`
76
+
77
+ If you are using Angular's `HttpClient`, prefer using `httpResource`. It is a specialized wrapper that leverages the Angular HTTP stack (including interceptors) while providing the same signal-based resource API.
@@ -1,56 +1,56 @@
1
- # Route Transition Animations
2
-
3
- Angular Router supports the browser's **View Transitions API** for smooth visual transitions between routes.
4
-
5
- ## Enabling View Transitions
6
-
7
- Add `withViewTransitions()` to your router configuration.
8
-
9
- ```ts
10
- provideRouter(routes, withViewTransitions());
11
- ```
12
-
13
- This is a **progressive enhancement**. In browsers that don't support the API, the router will still work but without the transition animation.
14
-
15
- ## How it Works
16
-
17
- 1. Browser takes a screenshot of the old state.
18
- 2. Router updates the DOM (activates new component).
19
- 3. Browser takes a screenshot of the new state.
20
- 4. Browser animates between the two states.
21
-
22
- ## Customizing with CSS
23
-
24
- Transitions are customized in **global CSS files** (not component-scoped CSS).
25
-
26
- Use the `::view-transition-old()` and `::view-transition-new()` pseudo-elements.
27
-
28
- ```css
29
- /* Example: Cross-fade + Slide */
30
- ::view-transition-old(root) {
31
- animation: 90ms cubic-bezier(0.4, 0, 1, 1) both fade-out;
32
- }
33
- ::view-transition-new(root) {
34
- animation: 210ms cubic-bezier(0, 0, 0.2, 1) 90ms both fade-in;
35
- }
36
- ```
37
-
38
- ## Advanced Control
39
-
40
- Use `onViewTransitionCreated` to skip transitions or customize behavior based on the navigation context.
41
-
42
- ```ts
43
- withViewTransitions({
44
- onViewTransitionCreated: ({transition, from, to}) => {
45
- // Skip animation for specific routes
46
- if (to.url === '/no-animation') {
47
- transition.skipTransition();
48
- }
49
- },
50
- });
51
- ```
52
-
53
- ## Best Practices
54
-
55
- - **Global Styles**: Always define transition animations in `styles.css` to avoid view encapsulation issues.
56
- - **View Transition Names**: Assign unique `view-transition-name` to elements that should transition smoothly across routes (e.g., a header image).
1
+ # Route Transition Animations
2
+
3
+ Angular Router supports the browser's **View Transitions API** for smooth visual transitions between routes.
4
+
5
+ ## Enabling View Transitions
6
+
7
+ Add `withViewTransitions()` to your router configuration.
8
+
9
+ ```ts
10
+ provideRouter(routes, withViewTransitions());
11
+ ```
12
+
13
+ This is a **progressive enhancement**. In browsers that don't support the API, the router will still work but without the transition animation.
14
+
15
+ ## How it Works
16
+
17
+ 1. Browser takes a screenshot of the old state.
18
+ 2. Router updates the DOM (activates new component).
19
+ 3. Browser takes a screenshot of the new state.
20
+ 4. Browser animates between the two states.
21
+
22
+ ## Customizing with CSS
23
+
24
+ Transitions are customized in **global CSS files** (not component-scoped CSS).
25
+
26
+ Use the `::view-transition-old()` and `::view-transition-new()` pseudo-elements.
27
+
28
+ ```css
29
+ /* Example: Cross-fade + Slide */
30
+ ::view-transition-old(root) {
31
+ animation: 90ms cubic-bezier(0.4, 0, 1, 1) both fade-out;
32
+ }
33
+ ::view-transition-new(root) {
34
+ animation: 210ms cubic-bezier(0, 0, 0.2, 1) 90ms both fade-in;
35
+ }
36
+ ```
37
+
38
+ ## Advanced Control
39
+
40
+ Use `onViewTransitionCreated` to skip transitions or customize behavior based on the navigation context.
41
+
42
+ ```ts
43
+ withViewTransitions({
44
+ onViewTransitionCreated: ({transition, from, to}) => {
45
+ // Skip animation for specific routes
46
+ if (to.url === '/no-animation') {
47
+ transition.skipTransition();
48
+ }
49
+ },
50
+ });
51
+ ```
52
+
53
+ ## Best Practices
54
+
55
+ - **Global Styles**: Always define transition animations in `styles.css` to avoid view encapsulation issues.
56
+ - **View Transition Names**: Assign unique `view-transition-name` to elements that should transition smoothly across routes (e.g., a header image).
@@ -1,52 +1,52 @@
1
- # Route Guards
2
-
3
- Route guards control whether a user can navigate to or leave a route.
4
-
5
- ## Types of Guards
6
-
7
- - **`CanActivate`**: Can the user access this route? (e.g., Auth check).
8
- - **`CanActivateChild`**: Can the user access children of this route?
9
- - **`CanDeactivate`**: Can the user leave this route? (e.g., Unsaved changes).
10
- - **`CanMatch`**: Should this route even be considered for matching? (e.g., Feature flags). If it returns `false`, the router continues checking other routes.
11
-
12
- ## Creating a Guard
13
-
14
- Guards are typically functional since Angular 15.
15
-
16
- ```ts
17
- export const authGuard: CanActivateFn = (route, state) => {
18
- const authService = inject(AuthService);
19
- const router = inject(Router);
20
-
21
- if (authService.isLoggedIn()) {
22
- return true;
23
- }
24
-
25
- // Redirect to login
26
- return router.parseUrl('/login');
27
- };
28
- ```
29
-
30
- ## Applying Guards
31
-
32
- Add them to the route configuration as an array. They execute in order.
33
-
34
- ```ts
35
- {
36
- path: 'admin',
37
- component: Admin,
38
- canActivate: [authGuard],
39
- canActivateChild: [adminChildGuard],
40
- canDeactivate: [unsavedChangesGuard]
41
- }
42
- ```
43
-
44
- ## Return Values
45
-
46
- - `boolean`: `true` to allow, `false` to block.
47
- - `UrlTree` or `RedirectCommand`: Redirect to a different route.
48
- - `Observable` or `Promise`: Resolves to the above types.
49
-
50
- ## Security Note
51
-
52
- **Client-side guards are NOT a substitute for server-side security.** Always verify permissions on the server.
1
+ # Route Guards
2
+
3
+ Route guards control whether a user can navigate to or leave a route.
4
+
5
+ ## Types of Guards
6
+
7
+ - **`CanActivate`**: Can the user access this route? (e.g., Auth check).
8
+ - **`CanActivateChild`**: Can the user access children of this route?
9
+ - **`CanDeactivate`**: Can the user leave this route? (e.g., Unsaved changes).
10
+ - **`CanMatch`**: Should this route even be considered for matching? (e.g., Feature flags). If it returns `false`, the router continues checking other routes.
11
+
12
+ ## Creating a Guard
13
+
14
+ Guards are typically functional since Angular 15.
15
+
16
+ ```ts
17
+ export const authGuard: CanActivateFn = (route, state) => {
18
+ const authService = inject(AuthService);
19
+ const router = inject(Router);
20
+
21
+ if (authService.isLoggedIn()) {
22
+ return true;
23
+ }
24
+
25
+ // Redirect to login
26
+ return router.parseUrl('/login');
27
+ };
28
+ ```
29
+
30
+ ## Applying Guards
31
+
32
+ Add them to the route configuration as an array. They execute in order.
33
+
34
+ ```ts
35
+ {
36
+ path: 'admin',
37
+ component: Admin,
38
+ canActivate: [authGuard],
39
+ canActivateChild: [adminChildGuard],
40
+ canDeactivate: [unsavedChangesGuard]
41
+ }
42
+ ```
43
+
44
+ ## Return Values
45
+
46
+ - `boolean`: `true` to allow, `false` to block.
47
+ - `UrlTree` or `RedirectCommand`: Redirect to a different route.
48
+ - `Observable` or `Promise`: Resolves to the above types.
49
+
50
+ ## Security Note
51
+
52
+ **Client-side guards are NOT a substitute for server-side security.** Always verify permissions on the server.
@@ -1,45 +1,45 @@
1
- # Router Lifecycle and Events
2
-
3
- Angular Router emits events through the `Router.events` observable, allowing you to track the navigation lifecycle from start to finish.
4
-
5
- ## Common Router Events (Chronological)
6
-
7
- 1. **`NavigationStart`**: Navigation begins.
8
- 2. **`RoutesRecognized`**: Router matches the URL to a route.
9
- 3. **`GuardsCheckStart` / `End`**: Evaluation of `canActivate`, `canMatch`, etc.
10
- 4. **`ResolveStart` / `End`**: Data resolution phase (fetching data via resolvers).
11
- 5. **`NavigationEnd`**: Navigation completed successfully.
12
- 6. **`NavigationCancel`**: Navigation canceled (e.g., guard returned `false`).
13
- 7. **`NavigationError`**: Navigation failed (e.g., error in resolver).
14
-
15
- ## Subscribing to Events
16
-
17
- Inject the `Router` and filter the `events` observable.
18
-
19
- ```ts
20
- import {Router, NavigationStart, NavigationEnd} from '@angular/router';
21
-
22
- export class MyService {
23
- private router = inject(Router);
24
-
25
- constructor() {
26
- this.router.events.pipe(filter((e) => e instanceof NavigationEnd)).subscribe((event) => {
27
- console.log('Navigated to:', event.url);
28
- });
29
- }
30
- }
31
- ```
32
-
33
- ## Debugging
34
-
35
- Enable detailed console logging of all routing events during application bootstrap.
36
-
37
- ```ts
38
- provideRouter(routes, withDebugTracing());
39
- ```
40
-
41
- ## Common Use Cases
42
-
43
- - **Loading Indicators**: Show a spinner when `NavigationStart` fires and hide it on `NavigationEnd`/`Cancel`/`Error`.
44
- - **Analytics**: Track page views by listening for `NavigationEnd`.
45
- - **Scroll Management**: Respond to `Scroll` events for custom scroll behavior.
1
+ # Router Lifecycle and Events
2
+
3
+ Angular Router emits events through the `Router.events` observable, allowing you to track the navigation lifecycle from start to finish.
4
+
5
+ ## Common Router Events (Chronological)
6
+
7
+ 1. **`NavigationStart`**: Navigation begins.
8
+ 2. **`RoutesRecognized`**: Router matches the URL to a route.
9
+ 3. **`GuardsCheckStart` / `End`**: Evaluation of `canActivate`, `canMatch`, etc.
10
+ 4. **`ResolveStart` / `End`**: Data resolution phase (fetching data via resolvers).
11
+ 5. **`NavigationEnd`**: Navigation completed successfully.
12
+ 6. **`NavigationCancel`**: Navigation canceled (e.g., guard returned `false`).
13
+ 7. **`NavigationError`**: Navigation failed (e.g., error in resolver).
14
+
15
+ ## Subscribing to Events
16
+
17
+ Inject the `Router` and filter the `events` observable.
18
+
19
+ ```ts
20
+ import {Router, NavigationStart, NavigationEnd} from '@angular/router';
21
+
22
+ export class MyService {
23
+ private router = inject(Router);
24
+
25
+ constructor() {
26
+ this.router.events.pipe(filter((e) => e instanceof NavigationEnd)).subscribe((event) => {
27
+ console.log('Navigated to:', event.url);
28
+ });
29
+ }
30
+ }
31
+ ```
32
+
33
+ ## Debugging
34
+
35
+ Enable detailed console logging of all routing events during application bootstrap.
36
+
37
+ ```ts
38
+ provideRouter(routes, withDebugTracing());
39
+ ```
40
+
41
+ ## Common Use Cases
42
+
43
+ - **Loading Indicators**: Show a spinner when `NavigationStart` fires and hide it on `NavigationEnd`/`Cancel`/`Error`.
44
+ - **Analytics**: Track page views by listening for `NavigationEnd`.
45
+ - **Scroll Management**: Respond to `Scroll` events for custom scroll behavior.