Commit graph

717 commits

Author SHA1 Message Date
Tobias Speicher
4ddcf81e61 refactor: replace deprecated String.prototype.substr() (#45397)
.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
2022-03-24 11:48:09 -07:00
Alan Agius
fc97499676 build(docs-infra): remove defaultProject workspace option (#45410)
The `defaultProject` workspace option has been deprecated. The project to use will be determined from the current working directory.

See: https://github.com/angular/angular-cli/pull/22852

PR Close #45410
2022-03-24 10:49:57 -07:00
Lee Cooper
8a7e624cda fix(docs-infra): fix tour of heroes global styles (#45329)
fix button styles in src/styles.css that are missing from code snippets

PR Close #45329
2022-03-15 13:24:52 -07:00
JiaLiPassion
c7cab69af1 docs(core): update triggerEventHandler samples (#45279)
PR Close #45279
2022-03-09 13:51:54 -08:00
Dmitrij Kuba
c9679760b2 refactor(router): take only the first emitted value of every resolver to make it consistent with guards (#44573)
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
2022-03-01 17:12:37 +00:00
dario-piotrowicz
9366a3c5f3 docs: improve structure of http example (#44986)
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
2022-02-28 19:31:25 +00:00
Guillaume Bonnet
cbbf13f100 docs(docs-infra): fix the stackblitz on page i18n-example (#45097)
The previous configuration didn't allow to serve in any language.

Fixes #45066

PR Close #45097
2022-02-28 17:25:40 +00:00
Jessica Janiuk
451bc27b96 test(animations): Fix flaky animations e2e test (#45196)
This adds a 300ms wait to the animations tests to ensure they are fully done animating before asserting.

PR Close #45196
2022-02-24 13:15:31 -08:00
dario-piotrowicz
66f3551a64 test(animations): add route animation delay to pages tests (#45144)
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
2022-02-24 18:41:55 +00:00
dario-piotrowicz
bad509688b docs: remove activatedRouteData backward accesses in aio guides (#45140)
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
2022-02-24 00:55:18 +00:00
Daniele Maltese
4fa530757b fix(docs-infra): removed duplicated style in aio examples (#45157)
Removed duplicated style in aio example scss files.

PR Close #45157
2022-02-22 15:35:16 -08:00
manuelkroiss
f28276c952 docs: replace deprecated SwUpdate#available/activated with new API (#44858)
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
2022-02-18 13:40:34 -08:00
dario-piotrowicz
be50401090 docs(animations): remove query call in animations example (#45126)
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
2022-02-18 13:35:22 -08:00
David Wolf
4ba95ea93a docs(forms): remove type duplicate from button in reactive-forms example (#45124)
PR Close #45124
2022-02-18 13:34:59 -08:00
AlirezaEbrahimkhani
32f83ab848 docs: solve the problem with Dynamic Component guide example (#45123)
solve ExpressionChangedAfterItHasBeenChecked error by changing the angular lifecycle hook ngAfterViewInit to ngOnInit

resolves angular#44925

PR Close #45123
2022-02-18 13:33:15 -08:00
Alan Cohen
66d45b0079 docs: fix test examples to use withContext (#45100)
PR Close #45100
2022-02-18 13:32:44 -08:00
zuckjet
f1d10baf08 docs(localize): fix angular.json syntax error about i18n (#45048)
In chapter internationlization at section "Deploy multiple locales" the
syntax for angular.json is wrong.

Close #45032

PR Close #45048
2022-02-15 12:31:11 -08:00
Jessica Janiuk
787eaa7a4b test(animations): Fix e2e intermittent failures (#45083)
This addresses a problem with animations e2e tests that were failing intermittently due to a missing timeout value

PR Close #45083
2022-02-14 15:45:40 -08:00
Dario Piotrowicz
569a262dfb docs(animations): improve aio animations guides info around :enter/:leave (#44550)
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
2022-02-14 09:16:29 -08:00
markostanimirovic
b4157449c4 refactor(docs-infra): replace deprecated subscribe usages (#45046)
This commit replaces deprecated `Observable.subscribe` usages.

PR Close #45046
2022-02-11 14:33:45 -08:00
Srdjan Milic
bbababe590 refactor(http): deprecated symbol used (#44985)
Support for passing an error value to "throwError" method will be removed in v8 of rxjs. More info at https://rxjs.dev/api/index/function/throwError#throwerror

PR Close #44985
2022-02-09 11:46:32 -08:00
Andrew Kushnir
64acbc4242 refactor(core): drop all .ngfactory and .ngsummary imports (#44957)
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
2022-02-07 15:31:49 -08:00
dario-piotrowicz
0d19be1996 refactor(docs-infra): add types to all the aio examples buttons (#44557)
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
2022-02-03 12:44:47 -08:00
dario-piotrowicz
e1f15a1899 refactor(docs-infra): remove outdated comments regarding CustomEvent (#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
2022-02-03 12:44:46 -08:00
Dario Piotrowicz
5498a35789 refactor(docs-infra): fix template eslint issues in aio examples (#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
2022-02-03 12:44:46 -08:00
markostanimirovic
fc1c143594 docs(router): use Resolve interface for custom title resolver (#44934)
PR Close #44934
2022-02-02 00:03:31 +00:00
Andrew Scott
910de8bc33 feat(router): Add Route.title with a configurable TitleStrategy (#43307)
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
2022-01-27 22:02:33 +00:00
Tim Bowersox
1610780577 docs: exclude setValue from async-validator-usage docregion (#44764)
Co-authored-by: Andrew Kushnir <43554145+AndrewKushnir@users.noreply.github.com>
PR Close #44764
2022-01-24 14:53:14 -08:00
Tim Bowersox
999cc7b841 docs: add missing return statement to validate() (#44764)
PR Close #44764
2022-01-24 14:53:14 -08:00
Tim Bowersox
811c244a40 docs: remove trailing space in code example (#44764)
PR Close #44764
2022-01-24 14:53:14 -08:00
Tim Bowersox
9f4b46796e docs: fix UniqueAlterEgoValidatorDirective (#44764)
PR Close #44764
2022-01-24 14:53:14 -08:00
Tim Bowersox
4948ab9ee5 docs: expand async validators in reactive forms (#44764)
* Hone docregions for code examples
* Add more detailed description

PR Close #44764
2022-01-24 14:53:14 -08:00
Tim Bowersox
765c860795 docs: restore UniqueAlterEgoValidator (#44764)
Update the docregion for the directive class to differentiate them

PR Close #44764
2022-01-24 14:53:14 -08:00
Tim Bowersox
34bbf664b5 docs: fix UniqueAlterEgoValidatorDirective (#44764)
* Use correct class name in providers
* Update parameter & return signature for validate()
PR Close #44764
2022-01-24 14:53:14 -08:00
Tim Bowersox
4098aac093 docs: update async validators section (#44764)
* 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
2022-01-24 14:53:14 -08:00
Yousaf Nawaz
34d2292323 docs: update deprecated form of the tap operator in http example (#44738)
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-arguments

Closes #44708

PR Close #44738
2022-01-19 09:22:02 -08:00
shejialuo
6e0481572f docs(docs-infra): change the testing guide due to deprecation (#44674)
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
2022-01-13 12:46:24 -08:00
alkavats1
277d2af007 docs(common): use <em> instead of <i> in examples (#44648)
Updated the html tag format from <i> to <em> in ts file. <em> tag helps to improve the code quality

PR Close #44648
2022-01-07 18:10:47 +00:00
shejialuo
7f51f1dcae docs(docs-infra): improve the content of attribute directives (#44628)
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
2022-01-06 18:36:46 +00:00
Dario Piotrowicz
7278a9c584 docs(animations): fix filter-animations docregion (#44544)
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
2022-01-05 17:46:10 +00:00
Dario Piotrowicz
d5ced77d31 refactor(docs-infra): fix eslint issues for aio ugrade-* examples (#44534)
fix the eslint issues in the aio/content/examples/upgrade-* folders
and remove their ignorePattern in the examples eslintrc file

PR Close #44534
2022-01-04 16:34:06 -08:00
Abdurrahman Abu-Hijleh
f0b4c709c9 docs: fix code sample indentation (#44517)
PR Close #44517
2022-01-04 12:15:55 -08:00
huangqing
bfd94b39d3 docs: Replace OnInit with AfterViewInit (#44485)
`this.adHost` is undefined if loadComponent is called in OnInit.
So replace OnInit with AfterViewInit!
PR Close #44485
2022-01-04 12:14:44 -08:00
dario-piotrowicz
835987b78b refactor(docs-infra): use eslint in aio's example-lint script (#43218)
Instead of the deprecated tslint use eslint in the aio's example-lint
script

PR Close #43218
2021-12-15 12:28:46 -05:00
Yousaf Nawaz
ab2248e773 docs(docs-infra): change variable names in route guards examples (#44444)
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
2021-12-14 16:08:05 -05:00
Kristiyan Kostadinov
95ed446009 refactor(docs-infra): clean up entryComponents usages (#44257)
Cleans up some usages of `entryComponents` from AIO.

PR Close #44257
2021-11-30 13:49:45 -05:00
dario-piotrowicz
6ae38584b0 docs(core): improve viewEncapsulation documentation (#44151)
Slighlty improve the `viewEncapsulation` documentation (both in code
comments and content files) to make it more clear and understandable.

See https://github.com/angular/angular/pull/44099#discussion_r745890903

PR Close #44151
2021-11-24 18:53:45 +00:00
Paul Gschwendtner
489cf42cd0 fix(common): incorrect error type for XHR errors in TestRequest (#36082)
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
2021-11-19 21:26:52 +00:00
fusho-takahashi
6c618de22e docs: Adding type annotation to ngOnInit() to make it consistent with the class structure produced by the CLI (#43579)
PR Close #43579
2021-11-16 14:09:51 -08:00
Ramesh Thiruchelvam
6d2276e17f test: type spy objects in test example (#44170)
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
2021-11-16 09:38:43 -08:00