Commit graph

29561 commits

Author SHA1 Message Date
Dany Paredes
2512f65e51 docs: add dany paredes to GDE resources (#46411)
PR Close #46411
2022-06-21 14:21:29 -07:00
JoostK
ddd6d66203 fix(core): deduplicate imports of standalone components in JIT compiler (#46439)
During JIT compilation of standalone components the compiler did not deduplicate
declarations in the imports array, unlike the AOT compiler. This may result in
runtime errors during directive matching, when the same component is found
multiple times resulting in NG0300, for example:

> NG0300: Multiple components match node with tagname mat-form-field: MatFormField and MatFormField.

This commit fixes the issue by deduplicating imports in the JIT compiler.

Relates to https://github.com/angular/angular/issues/46109#issuecomment-1160705031

Closes #46109

PR Close #46439
2022-06-21 12:41:16 -07:00
dario-piotrowicz
342effeb7d fix(animations): reset the start and done fns on player reset (#46364)
in the animation players, make sure than upon reset the
_onStartFns and _onDoneFns are also re-applied so that
they can be called again after resetting the animation

also set the noop animation player's _finished to false
when the player resets (needed to make sure that the _onDoneFns
get called)

resolves #26630

PR Close #46364
2022-06-21 12:40:24 -07:00
Derek Cormier
d2648d9d77 build(bazel): remove tsec patch to enable runfiles on Windows (#46447)
tsec previously did not use runfiles on Windows even when the flag was enabled.
The latest version now adds an option to force its usage.

PR Close #46447
2022-06-21 12:19:53 -07:00
dario-piotrowicz
db5d2683c8 fix(docs-infra): slightly improve aio-top-menu css (#46429)
slightly improve the aio-top-menu css by making it more robust
regarding differnt font-sizes and also remove unnecessary css rules

PR Close #46429
2022-06-21 12:19:12 -07:00
Kristiyan Kostadinov
08d3db232c fix(platform-server): invalid style attribute being generated for null values (#46433)
Fixes that the server renderer was producing an invalid `style` attribute when a null value is passed in. Also aligns the behavior with the DOM renderer by removing the attribute when it's empty.

Fixes #46385.

PR Close #46433
2022-06-21 11:54:52 -07:00
Andrew Kushnir
3d8787c961 fix(core): handle NgModules with standalone pipes in TestBed correctly (#46407)
Prior to this commit, the TestBed logic erroneously tried to apply provider overrides to standalone pipes that were imported in an NgModule. This commit updates the logic to recognize types that may have a scope (an NgModule or a standalone component) and skip other types while applying provider overrides recursively.

PR Close #46407
2022-06-21 11:54:19 -07:00
Andrew Kushnir
e1d2a9c591 refactor(core): rename internal method to account for standalone components (#46407)
Prior to standalone components, the `applyProviderOverridesToModule` method was used exclusively for NgModules. With standalone, its scope was expended to include standalone components as well. This commit renames the method to `applyProviderOverridesInScope` to better reflect this + also renames a field that refers to a set that contains already overridden types.

PR Close #46407
2022-06-21 11:54:19 -07:00
web-dave
96c70741ab docs: update ng-de date (#46446)
PR Close #46446
2022-06-21 11:49:09 -07:00
renovate[bot]
0c9af71f80 build: update scorecard action dependencies (#46440)
PR Close #46440
2022-06-21 11:48:29 -07:00
Paul Gschwendtner
ffedcdec08 build: replace copied spec_bundle rule in devtools with dev-infra rule (#46437)
Replaces the copied `spec_bundle` rule in the devtools folder with the
one provided by dev-infra. Initially we couldn't use the rule because
it wasn't available / and also later didn't work with the linker
version from `compiler-cli` built from `HEAD`.

PR Close #46437
2022-06-21 11:48:03 -07:00
Paul Gschwendtner
86248bb8d0 build: wire up ng-dev ts-node config loading (#46437)
With the new ESM version of `ng-dev`, the TypeScript config loading
cannot happen automatically because `ts-node` cannot hook into the
Node ESM module resolution at runtime. To fix this `ng-dev` is now
loading a plain `.ng-dev/config.mjs` and the runtime just needs to be
configured accordingly, i.e. running `ng-dev` with `ts-node` so that
the ESM loader can be wired up before Node's runtime starts (using e.g.
`node --loader`).

PR Close #46437
2022-06-21 11:48:03 -07:00
Paul Gschwendtner
3b077c05c4 build: update dev-infra package to latest version with full ESM (#46437)
Updates `angular/dev-infra` to the latest version which is now full ESM.

PR Close #46437
2022-06-21 11:48:03 -07:00
Paul Gschwendtner
0e3c2b2c40 ci: update renovate to update angular packages when available (#46437)
We recently aggressively limited Renovate to only two days and set the
hourly limit to one. This resulted in e.g. Angular not being updated
for quite a while now, as well as missing out on e.g. dev-infra updates
which should happen as often as possible.

This commit reworks the config to (1) avoid legacy syntax and (2) to
update Angular-cross repo depsas often as possible. Also groups Bazel
dependencies better and attempts to fix the non-working Babel dep
grouping.

PR Close #46437
2022-06-21 11:48:03 -07:00
Alan Agius
e8a33e75f4 docs: remove old bazel schematics doc (#46436)
This doc was intended for users migrating to version 10.

PR Close #46436
2022-06-21 11:47:35 -07:00
behrooz bozorg chami
1aa27ebbad docs: fix base href haser tag (#46431)
I add '>' end of header tag
Fixes #46430

PR Close #46431
2022-06-21 11:47:04 -07:00
markostanimirovic
cdd19bd30e docs(core): add full example for IfLoadedDirective (#46425)
This commit adds a full example for the IfLoadedDirective and moves
the code to the StackBlitz playground for structural directives.

Fixes #40739, #37119

PR Close #46425
2022-06-21 11:46:26 -07:00
dario-piotrowicz
88f53dcdbc feat(docs-infra): add open_in_new icon to external nav-item links (#46384)
add a mat open_in_new icon to the blog external link present in the
left sidenav on smaller screens so that it can be distinguished from
the other (/internal) links

this is a continuation of #45876

PR Close #46384
2022-06-21 11:45:57 -07:00
Andrew Scott
f94c6f433d fix(router): Expose CanMatchFn as public API (#46394)
The `CanMatchFn` is already exposed in the type signature for `canMatch` on the
`Route`. This function type should already be exposed as public API but was
missed in the initial implementation because the older guards use the `any` type
instead.

PR Close #46394
2022-06-17 09:18:08 -07:00
Andrew Scott
ce20ed067f fix(router): Ensure Route injector is created before running CanMatch guards (#46394)
Once a `Route` matches via the `match` or `path` property, we need to
immediately create the injector for the route (if it has providers)
before running the `CanMatch` guards. This is necessary because the
`CanMatch` guards might be provided in the `Route` providers.

Fixes #46386

PR Close #46394
2022-06-17 09:18:08 -07:00
Andrew Kushnir
bb7c80477b fix(core): make parent injector argument required in createEnvironmentInjector (#46397)
Previously, the `createEnvironmentInjector` function allowed creating an instance of an EnvironmentInjector without providing a parent injector. This resulted in an injector instance, which was detached from the DI tree, thus having limited value. This commit updates the types of the `createEnvironmentInjector` function to make the parent injector a required argument.

PR Close #46397
2022-06-17 09:17:24 -07:00
markostanimirovic
82acbf919b feat(http): improve error message for nullish header (#46059)
This commit improves the error message for nullish headers.

Fixes #46048

PR Close #46059
2022-06-16 14:39:41 -07:00
markostanimirovic
13bffaec19 docs(router): fix errors in CanMatch examples (#46388)
This commit fixes compilation errors in CanMatch examples.

PR Close #46388
2022-06-16 09:33:22 -07:00
Ramesh Thiruchelvam
07ea938aed refactor(common): align tree shakable error messages to the new format (#46382)
Simplifying the tree shakable error messages with the new format and removing the errorMessage variables

```ts
throw new RuntimeError(
RuntimeErrorCode.INJECTOR_ALREADY_DESTROYED,
ngDevMode && 'Injector has already been destroyed.');
```

PR Close #46382
2022-06-16 09:32:44 -07:00
Ramesh Thiruchelvam
df1652e7d7 refactor(common): align tree shakable error messages to new format (#46370)
Align tree shakable error messages are simplified with the new format and errorMessage variables are removed.

```ts
throw new RuntimeError(
  RuntimeErrorCode.INJECTOR_ALREADY_DESTROYED,
  ngDevMode && 'Injector has already been destroyed.');
```

PR Close #46370
2022-06-15 14:05:54 -07:00
4javier
d1e5ef51b6 docs: fix link to unpkged locales (#46379)
Add trailing slash to url
PR Close #46379
2022-06-15 14:05:14 -07:00
Aakash
2509d7681b docs: Add missing line in *zone-flags.ts* file for event-binding wiki. (#46369)
PR Close #46369
2022-06-15 14:04:43 -07:00
dario-piotrowicz
ba4f3aabee docs: add standalone details to NG0302 (#46090)
improve the error information of NG0302 by including details about
standalone pipes (and components)

PR Close #46090
2022-06-15 14:04:14 -07:00
dario-piotrowicz
463feb6a58 feat(docs-infra): add open_in_new icon to external aio-top-menu links (#45876)
add an open_in_new icon to the blog external link present in the
aio-top-menu so that it can be distinguished from the other (/internal)
links

resolves #38412

PR Close #45876
2022-06-15 14:03:29 -07:00
Jessica Janiuk
c2dab9d8cb
release: cut the v14.1.0-next.1 release (#46377) 2022-06-15 10:58:31 -07:00
Jessica Janiuk
0ab0baec15
docs: release notes for the v14.0.2 release (#46376) 2022-06-15 10:29:08 -07:00
Paul Gschwendtner
736b5456ea ci: override existing snapshot tag if publish snapshot job is restarted (#46366)
If the snapshot publish job is manually being restarted, the tag in the
snapshot repo might already exist and the job will fail. We can just
forcibly re-create the tag (even if it will be at the same revision).

We use force mode in a couple of other command as well, such as `git
push` of the actual tag and snapshot revision/SHA.

PR Close #46366
2022-06-15 15:57:56 +00:00
markostanimirovic
7a376466b3 feat(docs-infra): show dark scrollbars in dark mode (#46363)
With this commit, dark scrollbars will be shown when angular.io is in dark mode.

PR Close #46363
2022-06-15 15:56:38 +00:00
piyush132000
9ce733aacb docs: fix code style (#45527)
I have removed unnecessary code from the components & i initialize the
form in OnInit function (life cycle). I think initilization of forms and
getting data from service must be done inside ngOnInit.

PR Close #45527
2022-06-14 19:56:49 +00:00
JiaLiPassion
1120d540d8 release: cut the zone.js-0.11.6 release (#46232)
PR Close #46232
2022-06-14 19:53:52 +00:00
Badawi7
1278d2af6a docs: fix multicast observable example output (#46127)
Fix the order of logs that represent the output of the multicasting example, as the correct behavior is that all observers are notified of the final value before any of them is notified about completion.
PR Close #46127
2022-06-14 17:04:12 +00:00
Derek Cormier
2c8fd2b57b build(bazel): enable runfiles (#46313)
Patches are required for tsec and rules_webtesting. The fix for
rules_webtesting was merged to that repo
(581b1557e3)
but it's unclear when a release will be cut.

PR Close #46313
2022-06-14 16:58:19 +00:00
Alex Rickabaugh
714183d430 refactor(compiler-cli): add forceEmit flag to performCompilation (#46355)
In Bazel worker-land, workers which use incremental compilation must still
emit all declared outputs and cannot rely on these outputs persisting from
previous builds.

This commit adds a flag to `performCompilation` which can be used by the
worker infrastructure to instruct the compiler to always emit all possible
output files, regardless of any incremental build optimizations.

PR Close #46355
2022-06-14 15:56:32 +00:00
vivekkoya
86303f73c9 docs(core): fix broken link <BLANK LINE> Dead link is updated with new, working, and updated link. (#46359)
PR Close #46359
2022-06-14 15:55:19 +00:00
Andrew Scott
72e6a948bb refactor(router): Update recognize to use Observable instead of Promise (#46021)
The `Observable` chain is currenlty the most straightforward way to
handle navigation cancellations where we ensure that the cancelled
navigation does not continue to be processed. Until we design and
implement an alternative way to accomplish equivalent functionality,
we need to maintain the `Observable` chain wherever we might execute
user code. One reason for this isthat user code may contain redirects so we do not
want to execute those redirects if the navigation was already cancelled.

PR Close #46021
2022-06-13 22:53:49 +00:00
Andrew Scott
de058bba99 feat(router): Add CanMatch guard to control whether a Route should match (#46021)
Currently we have two main types of guards:
`CanLoad`: decides if we can load a module (used with lazy loading)
`CanActivate` and friends. It decides if we can activate/deactivate a route.
So we always decide where we want to navigate first ("recognize") and create a new router state snapshot. And only then we run guards to check if the navigation should be allowed.
This doesn't handle one very important use case where we want to decide where to navigate based on some data (e.g., who the user is).
I suggest to add a new guard that allows us to do that.

```
[
  {path: 'home', component: AdminHomePage, canUse: [IsAdmin]},
  {path: 'home', component: SimpleHomePage}
]
```

Here, navigating to '/home' will render `AdminHomePage` if the user is an admin and will render 'SimpleHomePage' otherwise. Note that the url will remain '/home'.

With the introduction of standalone components and new features in the Router such as `loadComponent`,
there's a case for deprecating `CanLoad` and replacing it with the `CanMatch` guard. There are a few reasons for this:

* One of the intentions of having separate providers on a Route is that lazy
loading should not be an architectural feature of an application. It's an
optimization you do for code size. That is, there should not be an architectural
feature in the router to specifically control whether to lazy load something or
not based on conditions such as authentication. This is a slight nuanced
difference between the proposed canUse guard: this guard would control whether
you can use the route at all and as a side-effect, whether we download the code.
`CanLoad` only specified whether the code should be downloaded so canUse is more powerful and more appropriate.
* The naming of `CanLoad` will be potentially misunderstood for the `loadComponent` feature.
Because it applies to `loadChildren`, it feels reasonable to think that it will
also apply to `loadComponent`. This isn’t the case: since we don't need
to load the component until right before activation, we defer the
loading until all guards/resolvers have run.

When considering the removal of `CanLoad` and replacing it with `CanMatch`, this
does inform another decision that needed to be made: whether it makes sense for
`CanMatch` guards to return a UrlTree or if they should be restricted to just boolean.
The original thought was that no, these new guards should not allow returning UrlTree
because that significantly expands the intent of the feature from simply
“can I use the route” to “can I use this route, and if not, should I redirect?”
I now believe it should allowed to return `UrlTree` for several reasons:

* For feature parity with `CanLoad`
* Because whether we allow it as a return value or not, developers will still be
able to trigger a redirect from the guards using the `Router.navigate` function.
* Inevitably, there will be developers who disagree with the philosophical decision
to disallow `UrlTree` and we don’t necessarily have a compelling reason to refuse this as a feature.

Relates to #16211 - `CanMatch` instead of `CanActivate` would prevent
blank screen. Additional work is required to close this issue. This can
be accomplished by making the initial navigation result trackable (including
the redirects).
Resolves #14515
Replaces #16416
Resolves #34231
Resolves #17145
Resolves #12088

PR Close #46021
2022-06-13 22:53:49 +00:00
Andrew Scott
96f5c971ba refactor(router): Move runCanLoadGuards to same location as similar functions (#46021)
This commit moves the runCanLoadGuards to the same location as other guard execution functions

PR Close #46021
2022-06-13 22:53:49 +00:00
Daniel Schmitz
9ab32616aa docs: Adding a book "Angular from Scratch" (#46352)
Adding a book "Angular from Scratch" in the resources file
PR Close #46352
2022-06-13 20:59:02 +00:00
Kristiyan Kostadinov
d6880c92f9 build: update angular version of in-memory-web-api (#46344)
Changes the required version of Angular in `angular-in-memory-web-api` to version 14.0.0.

Fixes #46332.

PR Close #46344
2022-06-13 17:40:09 +00:00
Paul Draper
b1a3dec58d fix(core): Resolve forwardRef declarations for jit (#46334)
Fix forwardRef() usage for declarations for jit. Resolves #45741.

PR Close #46334
2022-06-13 16:59:59 +00:00
Andrew Kushnir
131d029da1 feat(compiler-cli): detect missing control flow directive imports in standalone components (#46146)
This commit adds an extended diagnostics check that verifies that all control flow directives (such as `ngIf`, `ngFor`) have the necessary directives imported in standalone components. Currently there is no diagnostics produced for such cases, which makes it harder to detect and find problems.

PR Close #46146
2022-06-10 21:22:53 +00:00
JoostK
f35f4751b5 fix(compiler-cli): use inline type-check blocks for components outside rootDir (#46096)
An inline type-check block is required when a reference to a component class
cannot be emitted from an ngtypecheck shim file, but the logic to detect this
situation did not consider the configured `rootDir`. When a `rootDir` is
configured the reference emitter does not allow generating an import outside
this directory, which meant that a shim file wouldn't be able to reference
the component class. Consequently, type-check block generation would fail
with a fatal error that is unaccounted for, as gathering diagnostics should
be non-fallible.

This commit fixes the problem by leveraging the existing `canReferenceType`
logic of the type-checking `Environment`, instead of the rudimentary check
whether the class is exported as top-level symbol (`checkIfClassIsExported`).
Instead, `canReferenceType` pre-flights the generation of an import using the
`ReferenceEmitter` to tell exactly whether it will succeed or not; thus taking
into account the `rootDirs` constraint as well.

Fixes #44999

PR Close #46096
2022-06-10 20:40:16 +00:00
Kevin Davila
71b6b9e48b docs: Add kevindaviladev to contributors (#46330)
PR Close #46330
2022-06-10 17:58:50 +00:00
Tom Eustace
adb21a2416 docs: add angular#bundler to Enforcing Trusted Types section (#45450)
When a Content Security Policy is defined that uses trusted-types in an application that uses lazy chunk files, ng
serve will be broken as angular#bundler entry needs to be added to
Content Security Policy.

Fixes #44647

PR Close #45450
2022-06-10 16:11:41 +00:00
alefra
55a0efede2 docs: modify header and path (#45828)
Change header and path to match with file in the example folder

PR Close #45828
2022-06-10 16:11:09 +00:00