Commit graph

78 commits

Author SHA1 Message Date
Mateusz Daniluk
de777afbc5 refactor: standardize doctype declaration to <!DOCTYPE html> (#51052)
This commit standardizes the doctype declaration across all HTML files in the project to use `<!DOCTYPE html>`

PR Close #51052
2024-02-01 19:29:46 +00:00
Sylvain DEDIEU
9bb1884304 docs: change the file of the provideHttpClient standalone example to match cli generated project (#52806)
The "Providing HttpClient through dependency injection" documentation now shows that in case of a standalone boostraped app, the provideHttpClient is to include in the app.config.ts file.

Also updated the http setup server communication example to align the new doc (adev) with the old one (aio).

PR Close #52806
2024-01-25 21:24:58 +00:00
Doug Parker
849523f1b1 docs: update examples to use application builder (#52361)
`application` builder is preferred over `browser` builder. This updates all the examples I could find to use `application` builder. A couple notes of fixes that needed to happen:
1.  The testing example was broken because it relied on `~` imports in CSS files, which is a Webpack-specific features. However I don't think we need those custom styles at all, so I just removed the import altogether.
2.  A few tests seemed to be affected and needed to be cleaned up.

PR Close #52361
2023-11-01 16:24:42 -07:00
Matthieu Riegler
c2f270cf14 refactor(compiler): Delete the @angular/compiler/testing module. (#49872)
The package was removed in components, it can now be deleted here also.

PR Close #49872
2023-10-09 15:58:25 -07:00
Ward Bell
8ef5cc680d docs: Migrate HttpClient guide and its code examples (/http) to standalone (#51400)
**Unit Testing Code Does Not Compile**

The compilation error is:
```
The compilation error is
./src/testing/http-client.spec.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: /home/projects/obk3vc--run/src/testing/http-client.spec.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
```
I’m not sure what to say about unit testing HTTP in a full Standalone app. Is it different?

_This is the only known remaining defect in this conversion of HTTP to Standalone._

**Edited content of  `http-request-data-from-server.md`**

The current version of this page is confusing. In particular

* It tells readers they **should always unsubscribe** from the HttpClient method calls. This is *not true* and this example doesn't even do it. I replaced this instruction with more nuanced advice and an explanation of why it is OK to not unsubscribe to HttpClient methods.

* There is a "helpful" note about using the RxJS `map` operator to transform the response. This is *not "helpfulf"*. It is *confusing* because the sample doesn't use `map` anywhere. It was unnecessary here, even if it might be helpful elsewhere. I removed this note.

* The "Requesting a typed response" section seemed unclear to me, particularly because the guide begins with a `get` request that already has the `Config` return type specification. My revision attempts to make this more clear.

* The bold "callout" about the `observe` and `responseType` options appears out of nowhere after "Requesting a typed response". It's disconcerting at best. I moved it to the bottom of the page and linked to it from the `options` discussion at the top.

I made a few other revisions that I hope improve the readability of this page.

**Corrected `http-make-jsonp-request.md`**

The JSONP example, handwritten in the guide page, would not have compiled. I added one that does to `heroes.service.ts` and displayed it on this page.

**Corrected `http-handle-request-errors.md`

This page ended with a section called "Sending data to a server" that introduces PUT, POST, and DELETE. These features have nothing to do with error handling and the verbiage here duplicates the opening paragraphs of the next topic which does: "Send data to a server". So I deleted this section from the error handling guide page.

**Archived http-setup-server-communication.md**

`http-setup-server-communication.md` appears to be the original long document that has since been divided over the other pages in this folder.

It shouldn’t be in the reader’s flow. I did update it for Standalone. But I also removed it from left-nav and marked as archived.

PR Close #51400
2023-08-29 21:03:49 +00:00
Angular Robot
27d43a4a7f build: lock file maintenance (#51134)
See associated pull request for more information.

PR Close #51134
2023-07-24 08:12:51 -07:00
alkavats1
9acc0e32c4 docs: refactored the markup tags (#50481)
PR Close #50481
2023-05-30 09:21:58 -07:00
Paul Gschwendtner
adb337c179 build: ensure chromium is not using sandbox within Bazel sandbox for AIO example e2e tests (#49293)
Chromium is launched via Karma from within the Bazel AIO example e2e
tests. This breaks depending on the platform and sandbox mechanism used.

We should never use Chromium's sandbox on top of Bazel's sandbox
invocation. The Angular CLI exposes a browser exactly for this use-case.

PR Close #49293
2023-03-03 19:41:35 +00:00
Derek Cormier
7a134cf41a build(bazel): incrementally run aio example e2e tests
Replaces the workflow where all example e2es are run at once
2022-11-22 13:51:16 -07:00
Derek Cormier
9a27c4cb50 build(bazel): incrementally build aio example zips and live examples
The existing scripts were amended to work on one example at a time
2022-11-22 13:51:16 -07:00
Alan Agius
32135b27a1 docs: update examples to reflect changes in Angular CLI version 15. (#47904)
These changes include
- Remove the usage of `enableProdMode`
- Remove `test.ts`, `polyfills.ts`, `karma.conf.js` and environment files which are no longer generated by default

PR Close #47904
2022-11-03 17:46:46 -07:00
Tom Raithel
551671fd51 docs: fix division by zero in progress events example (#46077)
If the `event.total` is undefined, this line would have generated a `NaN` due to division by zero. I suppose, that a `0` would be more suitable for this case.

PR Close #46077
2022-05-23 13:27:45 -07:00
Bob Watson
274c6fa643 docs: remove Narco from hero list in code, text, and images (#46008)
Fixes issue #45769

Removes the malevolent comic book character, "Narco," from the list of heroes. This change removes the reference from the code, text and screenshots used in the documentation and makes other minor edits as necessary.

PR Close #46008
2022-05-17 17:47:03 +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
Alan Cohen
66d45b0079 docs: fix test examples to use withContext (#45100)
PR Close #45100
2022-02-18 13:32:44 -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
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
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
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
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
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
George Kalpakas
7555e9fb8a docs: use correct service name when creating error handler in http example (#43767)
PR Close #43767
2021-10-08 20:17:58 +00:00
Paul Gschwendtner
77cb17166e test(docs-infra): update http test to use correct charset name due to chromium update (#43431)
We updated the dev-infra version as part of the v13 package format
in order to be able to use the latest `rollup` version (and its
plugins). The update of the shared dev-infra package resulted in an
update of Chromium to a more recent version. This version of Chromium
seems to normalize the `content-type` header differently, so that the
AIO `http` example test assertion needs to be updated to work with the
new version of chromium. This commits updates the test.

PR Close #43431
2021-10-01 18:28:46 +00:00
Pete Bacon Darwin
7efa47075c docs: remove http example dependency on 3rd party service (#43475)
Previously the `http` example did accessed the npmsearch.com website to demonstrate response caching.
But if this service became unavailable then the example (and its e2e tests) would fail.

This commit changes the example to use the in-memory-web-api for this lookup, which will not be affected by 3rd party outages.

The guide that references this example has been updated to avoid references to the original npm search service.

PR Close #43475
2021-09-16 15:59:05 +00:00
George Kalpakas
93590895b5 build(docs-infra): update docs examples to Angular v12.1.3 (#42949)
This commit updates the docs examples to Angular v12.1.3. In addition to
updating the dependencies versions, it also updates the projects'
structure and configs to more closely match what a new v12 CLI app would
look like. See, also, the [diff][1] between a basic v11.2.11 CLI app and
a v12.1.3 one.

[1]: https://github.com/cexbrayat/angular-cli-diff/compare/11.2.11..12.1.3

PR Close #42949
2021-08-09 09:41:00 -07:00
Bastian
50b6aae029 docs: fix http example to show actual message in console (#42773)
Previously, the error message in the console would print `[object Object]`
and not the actual error message. With this change, the error message is
printed in the console.

PR Close #42773
2021-07-09 10:14:35 -07:00
pavlenko
f3965ff834 docs: setting context value inside an interceptor (#42699)
Usage of `get`/`set` methods should be done on a context object instead of a `HttpRequest` instance.

PR Close #42699
2021-06-30 09:13:46 -07:00
Sam Severance
62becc88f9 fix(docs-infra): fix example compilation issues (#42199)
Fix an issue that prevented the Http (tests) StackBlitz
and Testing (tests) StackBlitz from compiling.

Resolves #42198

PR Close #42199
2021-05-21 18:07:44 +00:00
iRealNirmal
5885cf5ad8 build(docs-infra): fixed broken stackblitz examples (#42122)
This commit fixes the broken stackblitz examples.

Closes #42116 .

PR Close #42122
2021-05-18 08:34:40 -07:00
Kristiyan Kostadinov
e86a1d3441 docs: make all examples compatible with strict mode (#41999)
Turns on the `strict` compiler flag and resolves the compilation errors in the various AIO examples.

PR Close #41999
2021-05-17 10:42:18 -07:00
Wojciech Okoński
ea89617880 docs(docs-infra): fix handling of client-side errors in networking (#36608)
Previously example for handling client-side errors in networking didn't work when there was no Internet connection.
Caught error is ProgressEvent in such case, not ErrorEvent and error.error.message is undefined.

PR Close #36608
2021-04-29 13:51:42 -07:00
Kapunahele Wong
09abee359d docs: add metadata documentation to httpClient (#41706)
PR Close #41706
2021-04-26 15:17:51 -07:00
Kapunahele Wong
70fb3e958b docs: improve accessibility of http example (#41057)
PR Close #41057
2021-04-26 09:11:07 -07:00
Kapunahele Wong
356d9a0537 docs: improve contrast of colors and body padding in boilerplate CSS (#40890)
Shifts colors to pass WebAIM contrast checker and adds media
query so that body padding is smaller at smaller widths.
Body padding responsiveness will help on StackBlitz and small
screens.

PR Close #40890
2021-03-01 15:30:32 -08:00
Pete Bacon Darwin
4859c0947a build(docs-infra): implement full template checking for examples (#40930)
This commit turns on full template type checking and fixes the examples
that had errors.

PR Close #40930
2021-02-26 15:40:44 -08:00
Alan Agius
d51d39cb4c docs: update docs to use new zone.js entry-points (#40823)
In CLI version 12, the old style of imports is no longer supported.

PR Close #40823
2021-02-24 07:58:29 -08:00
Kapunahele Wong
49e02ca7d6 docs: move JsonParser class above CustomJsonInterceptor (#40964)
This move fixes the error in StackBlitz of
Cannot access 'JsonParser' before initialization

PR Close #40964
2021-02-23 10:37:26 -08:00
Pete Bacon Darwin
529f0a83cb docs(http): add custom JSONParser example (#40645)
Update the HTTP guide and associated example to demonstrate
how an interceptor can be used to provide a custom JSON parser.

Resolves #21079

PR Close #40645
2021-02-16 08:03:33 -08:00
Pete Bacon Darwin
4a9f7daf37 docs: remove unused "docregions" (#40479)
This commit removes all the docregion tags in examples that are not
being referenced in any doc.

PR Close #40479
2021-01-20 16:12:15 -08:00
Alexey Elin
f846c093b1 docs: specify fallback generic font family (#40254)
https://developer.mozilla.org/en-US/docs/Web/CSS/font-family
"You should always include at least one generic family name in a font-family list,
 since there's no guarantee that any given font is available. This lets the browser
 select an acceptable fallback font when necessary."

PR Close #40254
2021-01-06 07:09:27 -08:00
Alexey Elin
13dfef14dc docs: remove cursor: hand (#39918)
PR Close #39918
2020-12-09 09:04:54 -08:00
George Kalpakas
23c36a24ed test(docs-infra): disable the Selenium Promise Manager in docs examples e2e tests (#39818)
This commit disables the Selenium Promise Manager when running e2e tests
for docs examples in order to more closely align them with new apps
created with CLI v11. This change requires that any async operations in
tests are handled explicitly (e.g. using `async/await` or
`Promise#then()`).

PR Close #39818
2020-11-24 14:56:14 -08:00
George Kalpakas
c5e178997c build(docs-infra): update docs examples to Angular v10 (#38993)
This commit updates the docs examples to Angular v10.1.3. In addition to
updating the dependencies versions, it also updates the project's
structure and config to more closely match what a new v10 CLI app would
look like. See, also, the [diff][1] between a basic v9.1.4 CLI app and a
v10.1.3 one.

[1]: https://github.com/cexbrayat/angular-cli-diff/compare/9.1.4..10.1.3

PR Close #38993
2020-09-28 16:24:59 -04:00
George Kalpakas
5303773daf refactor(docs-infra): fix docs examples for tslint rule prefer-const (#38143)
This commit updates the docs examples to be compatible with the
`prefer-const` tslint rule.

This is in preparation of updating the docs examples `tslint.json` to
match the one generated for new Angular CLI apps in a future commit.

PR Close #38143
2020-07-31 11:00:06 -07:00
George Kalpakas
1db4f508e6 refactor(docs-infra): fix docs examples for tslint rules related to variable names (#38143)
This commit updates the docs examples to be compatible with the
`no-shadowed-variable` and `variable-name` tslint rules.

This is in preparation of updating the docs examples `tslint.json` to
match the one generated for new Angular CLI apps in a future commit.

PR Close #38143
2020-07-31 11:00:06 -07:00
George Kalpakas
8aa29438ac refactor(docs-infra): fix docs examples for tslint rules related to object properties (#38143)
This commit updates the docs examples to be compatible with the
`no-string-literal`, `object-literal-key-quotes` and
`object-literal-shorthand` tslint rules.

This is in preparation of updating the docs examples `tslint.json` to
match the one generated for new Angular CLI apps in a future commit.

PR Close #38143
2020-07-31 11:00:06 -07:00
George Kalpakas
fc709423f2 refactor(docs-infra): fix docs examples for tslint rule only-arrow-functions (#38143)
This commit updates the docs examples to be compatible with the
`only-arrow-functions` tslint rule.

This is in preparation of updating the docs examples `tslint.json` to
match the one generated for new Angular CLI apps in a future commit.

PR Close #38143
2020-07-31 11:00:06 -07:00
George Kalpakas
77f38d3be1 style(docs-infra): fix docs examples for tslint rule semicolon (#38143)
This commit updates the docs examples to be compatible with the
`semicolon` tslint rule.

This is in preparation of updating the docs examples `tslint.json` to
match the one generated for new Angular CLI apps in a future commit.

PR Close #38143
2020-07-31 11:00:05 -07:00
George Kalpakas
7c0f11789b style(docs-infra): fix docs examples for tslint rules related to whitespace (#38143)
This commit updates the docs examples to be compatible with the `align`,
`space-before-function-paren` and `typedef-whitespace` tslint rules.

This is in preparation of updating the docs examples `tslint.json` to
match the one generated for new Angular CLI apps in a future commit.

PR Close #38143
2020-07-31 11:00:05 -07:00