.substr() is deprecated so we replace it with functions which work similarily but aren't deprecated
Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
PR Close#45397
The router used to wait for the resolvers to complete and take the last
value. The changes here take only the first
emitted value of every resolver and proceed the navigation. This matches
how other guards work in the `Router` code.
Resolves https://github.com/angular/angular/issues/44643
BREAKING CHANGE: Previously, resolvers were waiting to be completed
before proceeding with the navigation and the Router would take the last
value emitted from the resolver.
The router now takes only the first emitted value by the resolvers
and then proceeds with navigation. This is now consistent with `Observables`
returned by other guards: only the first value is used.
PR Close#44573
improve the http aio example by:
- adding a background color to the messages section so that it
can be distinguished from the others
- avoid using `hr` elements to divide the various sections, use
css instead (so that the divisions can also be omitted when
the sections are not being shown)
- fix the erroneous presence of an input text element inside a button
(see: https://github.com/angular/angular/pull/44557#discussion_r787239658)
PR Close#44986
PR #44550 introduced an animation for pages/tabs transitions in the
animations example application, after such change intermittent e2e
failures started to occur (see for example: #45083), add a delay to
account for such animation to all the animations pages/tabs e2e tests so
to fix the flakyness caused by the animation
PR Close#45144
developers should not access the router-outlet directive in their
template before defining a template variable for it, such
implementation is present in a couple of aio guides, fix such guides
so that they show the more correct way of accessing the outlet's data
resolves#36173
PR Close#45140
Since `SwUpdate#available` and `SwUpdate#activated` are deprecated, the new way should be included in the docs instead of the deprecated one.
docs: added missing imports
added imports for VersionReadyEvent, filter, and map
docs: updated service-worker-communications.md
rewrite of SwUpdate service to describe the new versionUpdates property
docs: Apply suggestions from code review
Co-authored-by: George Kalpakas <kalpakas.g@gmail.com>
docs: added events
added VERSION_DETECTED and VERSION_INSTALLATION_FAILED
docs: Apply suggestions from code review
Co-authored-by: George Kalpakas <kalpakas.g@gmail.com>
PR Close#44858
the query call used for the transition between the Home and About tabs
doesn't work as intented since it doesn't find any matching element,
remove such quering since it is not needed
PR Close#45126
improve the aio animations guide information around elements entering and
leaving, this includes, querying them, their transitions and also improvements
to the animations guide live examples
PR Close#44550
This commit updates various places in the repo (mostly tests/examples) to drop all `.ngfactory` and `.ngsummary` imports as they are no longer needed in Ivy.
PR Close#44957
add types to all the buttons in the angular.io examples to encourage
the best practice of always including a type per button (regardless
to whether it is in a form or now)
PR Close#44557
remove the comments present in aio examples saying that for older
browsers such as IE CustomEvent could be necessary (as the the Event
constructor could be not available)
such comments are no longer necessary/relevant since the Event constructor
is available for all the supported browsers
PR Close#44557
the aio examples have various eslint issues regarding template rules, those
are currently turned off and TODO comments have been added to them in the
examples eslintrc, fix such issues and remove the respective TODO comments
this also includes examples refactoring to use buttons for better accessibility,
this change tries to make the smallest amound of changes to the examples' behaviors
and designs/UI
PR Close#44557
This commit provides a service, `PageTitleStrategy` for setting
the document page title after a successful router navigation.
Users can provide custom strategies by extending `TitleStrategy` and
adding a provider which overrides it.
The strategy takes advantage of the pre-existing `data` and `resolve` concepts
in the Router implementation:
We can copy the `Route.title` into `data`/`resolve` in a
non-breaking way by using a `symbol` as the key. This ensures that we
do not have any collisions with pre-existing property names. By using
`data` and `resolve`, we do not have to add anything more to
the router navigation pipeline to support this feature.
resolves#7630
PR Close#43307
* Update the UniqueAlterEgoValidator code example
* Add async-validator docregion to hero-form-reactive.component.2.ts
* Fix typo under Implementing a custom async validator
* Add h3 sections for adding async validators to reactive & template-driven forms
PR Close#44764
update deprecated form of the tap operator. Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments
DEPRECATED: tap operator subscribe signature is deprecated
Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-argumentsCloses#44708
PR Close#44738
The jasmine used in the docs is
```typescript
expect(<variableName>).<matcher>(predicate, failOutput)
```
The new version should be
```typescript
expect(<variableName>).withContext(failOutput).<matcher>(predicate)
```
So, this commit mainly focuses on changing the former to latter with
format below
```typescript
expect(<variableName>)
.withContext(failOutput)
.<matcher>(predicate)
```
And for RxJs, see https://rxjs.dev/deprecations/subscribe-arguments.
> For example someone could name functions poorly and confuse the next
reader: `source$.subscribe(doSomething, doSomethingElse, lol)` with that
signature, you have to know unapparent details about subscribe, where
using a partial observer solves that neatly: `source$.subscribe({ next:
doSomething, error: doSomethingElse, complete: lol }`).
This commit also does this conversion.
Last, remove the unused imported `async` from file
`twain.component.marbles.spec.ts`.
PR Close#44674
Improve docs "Understanding Angular-Directives-Attribute Directives"
In `highlight.directive.1.ts`, add the `private` keyword for `el` property
to make it correct and consistent with subsequent examples.
For section "Setting the value with user input", add a step to tell the
reader change the method `onMouseEnter`, thus more readable.
For section "Binding to a second property", delete the aliase for the
`Input` property, and changes the name back to `appHighlight` in the code
to make it consistent with the whole tutorial.
PR Close#44628
the filter animation example in the complex-animation-sequences guide
talks about entering and leaving elements, but the presented html
snipped exluded the *ngFor which actually adds and removes the elements,
so add the *ngFor section to make the example complete and
understandable
PR Close#44544
change variable name 'next' to 'route' in route guards examples on developer guides "Routing and Navigation Tutorial: Adding routing to Tour of Heroes" to make it consistent with api docs and subsequent examples.
Fixes#44291
PR Close#44444
Currently the `HttpClient` always wraps errors from XHR requests, but
the underlying errors are always of type `ProgressEvent`, or don't have
a native error if the status code is just indicating failure (e.g. 404).
This behavior does not match in the `TestRequest` class provided by
`@angular/common/http/testing` where errors are considered being
of type `ErrorEvent`. This is incorrect because `ErrorEvent`s provide
information for errors in scripts or files which are evaluated. Since
the `HttpClient` never evaluates scripts/files, and also since XHR requests
clearly are documented to emit `ProgressEvent`'s, we should change the
`TestSupport` to retrieve such `ProgressEvent`'s instead of incompatible
objects of type `ErrorEvent`.
In favor of having a deprecation period, we keep supporting `ErrorEvent`
in the `TestRequest.error` signature. Eventually, we can remove this
signature in the future.
Resources:
* https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/error_event
* https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent
* https://xhr.spec.whatwg.org/#event-xhr-errpr
Related to: https://github.com/angular/angular/issues/34748.
DEPRECATED: `TestRequest` from `@angular/common/http/testing` no longer
accepts `ErrorEvent` when simulating XHR errors. Instead instances of
`ProgressEvent` should be passed, matching with the native browser behavior.
PR Close#36082
Example for test doesn't use typing for Jasmine Spy objects. Updated
them with `SpyObj<T>` typing as in the Angular Documentation.
See https://angular.io/guide/testing-services
PR Close#44170