Currently the migration is set up to assume that any elements that exist in a `declarations` array will be converted to standalone and copied into the `imports` array, however that might be incorrect for some special cases like the root component.
These changes rework the declaration merging logic so that they take all the declarations being migrated into account.
PR Close#48882
Fixes that running the standalone migration with `--defaults` was throwing an error, because all the properties were specified as required. We don't need to set them as required, because they have default values.
Fixes#48845.
PR Close#48921
Fixes that we were changing the testing modules that have no `declarations` unnecessarily, resulting in more formatting changes that users would have to clean up.
PR Close#48921
Jasmine has deprecated the `expectationFailOutput` argument and replaced it by the `withContext()` method
Also removing all references to #24571 from the forms unit tests as the non null assertions are fine in the context.
PR Close#48894
Previously, the state `script` was always appended as the last item in the `body` tag. This can result in the state not being available when the Angular application is bootstrap.
A workaround for this was to delay the bootstrapping of the application until by using the `DOMContentLoaded` event listener.
```ts
const bootstrap = () => platformBrowserDynamic().bootstrapModule(AppModule);
document.addEventListener('DOMContentLoaded', bootstrap);
```
With this change the above workaround is no longer necessary as the state `script` tag is now added prior of any other `script` which guarantees that the state is present prior of the Angular application is bootstrapped.
PR Close#48868
StrongBrew has stopped a few years back.
We are taking over at https://simplified.courses where we have an Angular blog, do on-site training and create content.
PR Close#48340
It seems that the description of the `FormControl` usage is incorrect or at least the copy is not very helpful for beginners and can be very confusing as we do not have a command to generate a `FormControl`, as far as I know 😄. Additionally, the link for component generation points to the CLI page instead of the component generation section on the CLI page. It would be DX/UX for readers and users to get where the link's text is supposed to take them.
PR Close#48858
the easing "prop" used to specify the easing function to
apply to animations isn't a valid css property, it is thus
considered not animatable but different values for such
property shouldn't cause non-animatable warnings
resolves#48571
PR Close#48583
Adds a new mode to the `@angular/core:standalone` schematic that allows users to switch from `bootstrapModule` to `bootstrapApplication`, as well as `provideRouter`, `provideAnimations` and `provideNoopAnimations`.
PR Close#48848
Fixes that the migration host was doing a basic falsy check if the content was read correctly which meant that a component with an empty template would be considered as having a missing template file.
Fixes#48846.
PR Close#48849
Both TypeScript and Angular Schematic rely on posix system paths which can cause issues on Windows if paths are not normalized correctly.
Such as `sourceFile.fileName.startsWith(pathToMigrate)` on Windows will always return falsey.
PR Close#48850
Currently the `mode` is validated during schematic execution. While this cover a case of incorrect value this caused other parts were the correct values cannot be determined.
Options in schemas are used for a number of reasons during runtime.
- These are used to build auto complete
- Validation of inputs prior of the schematic is built with meaningful errors such as suggested inputs.
- Generation of help output.
Eventually these should also be used to generate DTS. This is already done in the CLI to avoid having to write Types manually.
PR Close#48851
In order to test components and services which depend on router navigations, such as `ActivatedRoute` instances, tests currently need to provide a fair bit of boilerplate _or_ they can set up a stub for `ActivatedRoute` and list it in the `providers` to override it in `TestBed`. This approach of stubbing the `ActivatedRoute` creates a situation that can easily cause the test to break. The stub often only mocks out the dependencies that the component/service _currently_ needs. This dependencies might change over time and break the test in an unexpected way. In addition, it is difficult to get the structure of `ActivatedRoute` exactly correct.
This change will allow unit tests to quickly set up routes, trigger real navigations in the Router, and get instances of component's to test along with real instances of `ActivatedRoute`. This all comes without needing to know that the component depends on `ActivatedRoute` at all. This becomes more important when considering that a component may be refactored in the future to use `@Input` rather than access data on the `ActivatedRoute` instance (see #18967). Tests which mock out `ActivatedRoute` would all break, but those which use `navigateForTest` would continue to work without needing any updates.
resolves#15779resolves#48608
PR Close#48552
There may be use-cases in the future where `afterNextNavigation` is used
in other locations. For example, a test helper function which navigates
should likely wait for all redirects to complete rather than simply
waiting for the promise returned from `navigate` to resolve.
PR Close#48552
Warn the user in the console in case the `ngSrcset` is present and no
loader is configured. In this case, the default loader is used and
it ignores this attribute.
PR Close#48804
To remove the non-null assertions linked to #24571, DowngradeComponentAdapter has been refactored and the public methods have been simplifed.
PR Close#48715
Fixes that the expression converter was producing code that throws a runtime error if a non-null assertion is used as a part of a safe read, write or call.
Fixes#48742.
PR Close#48801
Adds a new mode to the `@angular/core:standalone` schematic that automatically deletes modules that may not be necessary after the previous step of converting them to standalone.
PR Close#48832
remove the following utilities used in unit tests which check for features
that are supported by all supported browsers:
- supportsCustomElements
- supportsWebAnimation
- supportsRegExUnicodeFlag
- supportsTemplateElement
also remove the following utilities which check for features that are
not supported (and aren't going to be) by any of the supported browsers:
- supportsDeprecatedCustomCustomElementsV0
- supportsDeprecatedShadowDomV0
PR Close#47543
The main entry point for the `@angular/localize` package no longer imports
the `@angular/compiler` package and now has no external dependencies. This
allows the main functionality of the package to be used without requiring
any other Angular packages. Only the message digest algorithm implementation
from the `@angular/compiler` package was being used and this code is now
bundled directly into the final npm package for `@angular/localize`.
The `tooling` secondary entry point still leverages and requires Angular
related packages (`@angular/compiler`/`@angular/compiler-cli`). However,
the tooling functionality is not intended to be used and/or bundled in
a web application.
Closes#48163
PR Close#48799
In Css, selectors with escaped characters require a space after if the following character is a hex character. ie: .\fc ber which matches class="über"
These escaped selectors happen for example when esbuild run with `optimization.minify`
fixes#48524
PR Close#48558
Implements a new `ng generate @angular/core:standalone` schematic that allows the user to convert all the declarations in a set of NgModules to standalone.
PR Close#48790