Commit graph

181 commits

Author SHA1 Message Date
Joey Perrott
c4b880a025 refactor: migrate docs, examples, private, service worker and upgrade to prettier formatting (#54163)
Migrate formatting to prettier for docs, examples, private, service worker and upgrade from clang-format

PR Close #54163
2024-01-30 20:08:40 +00:00
Andrew Scott
c2dd703d2f refactor(core): Remove internal-only testability features (#53767)
This commit removes the testability features that are internal only.
This simplifies the implementation of testability which will need
updates to support zoneless. Those updates will be easier to manage if
the Testability implementation is simpler.
While protractor is indeed officially EOL, we will still need to do some
updates to support teams migrating to zoneless that have protractor
tests.

As far as protractor's own use of `whenStable`, it does not read the
internal only methods either:
https://github.com/angular/protractor/blob/master/lib/clientsidescripts.js
Anything else depending on these values are not following the defined public API
contract.

PR Close #53767
2024-01-09 14:46:46 -08:00
Etienne FRANK
cfd89b0833 docs(forms): replace fb with formBuilder (#52261)
Shorten variable names isn't a good practice. To avoid spreading it, we removed it from Angular's documentation.

PR Close #52261
2023-10-19 09:24:39 -07:00
Kristiyan Kostadinov
52cc7f839b build: align with internal tsconfig options (#51728)
Currently internally Angular has some customized tsconfig files, because we don't align with the tsconfig of the rest of g3. These changes enable `noImplicitReturns` and `noPropertyAccessFromIndexSignature` to align better with the internal config.

PR Close #51728
2023-09-12 11:39:42 -07:00
AleksanderBodurri
c1dee4cfe3 test(core): unit tests for the injector profiler and injector debugging APIs (#48639)
Creates unit tests for the following APIs

    - setInjectorProfiler
    - getInjectorProviders
    - getInjectorResolutionPath
    - getDependenciesFromInjectable

    Modifies existing tests in

    - packages/examples/core/di/ts/injector_spec.ts
    - packages/core/test/render3/jit/declare_injectable_spec.ts
    - packages/core/test/render3/jit/declare_factory_spec.ts

    because they setup framework injector context manually.

    Exports setInjectorProfilerContext in packages/core/src/core_private_export.ts in order for use
    in the the modified tests above.

PR Close #48639
2023-08-01 11:44:40 -07:00
hyperlife1119
29d358170b feat(common): add component input binding support for NgComponentOutlet (#51148)
This commit add component input binding support for NgComponentOutlet.

PR Close #51148
2023-07-25 09:16:19 -07:00
Alex Rickabaugh
55d6147d29 Revert "feat(common): add component input binding support for NgComponentOutlet (#49735)"
This reverts commit f3867597f0. This PR has
property renaming bugs in g3.
2023-06-08 10:32:49 -07:00
hyperlife1119
f3867597f0 feat(common): add component input binding support for NgComponentOutlet (#49735)
This commit add component input binding support for NgComponentOutlet.

PR Close #49735
2023-06-08 10:00:34 -07:00
Matthieu Riegler
a270caa259 docs: ngComponentOutlet doc with projected template (#50173)
Give an example of projected content by a component outlet with ng-templates

PR Close #50173
2023-05-19 16:35:48 +00:00
Naaajii
bb4875682d docs: remove plnkr link from markForCheck example (#50328)
PR Close #50328
2023-05-17 08:13:54 -07:00
Naaajii
4707d5678a docs: update live demo for change detector (#50328)
fixes #44553

PR Close #50328
2023-05-17 08:13:54 -07:00
Matthieu Riegler
3b863ddc1e refactor(core): Remove ReflectiveInjector symbol (#48103)
The `ReflectiveInjector` symbol has been deprecated in v5 (11 major versions ago). This commit removes ReflectiveInjector and related symbols.

BREAKING CHANGE: The `ReflectiveInjector` and related symbols were removed. Please update the code to avoid references to the `ReflectiveInjector` symbol. Use `Injector.create` as a replacement to create an injector instead.

PR Close #48103
2023-04-04 16:43:53 -07:00
Kristiyan Kostadinov
585e34bf6c feat(core): remove entryComponents (#49484)
`entryComponents` have been deprecated since version 9, because with Ivy they weren't necessary. These changes remove any remaining references.

BREAKING CHANGE:
* `entryComponents` has been deleted from the `@NgModule` and `@Component` public APIs. Any usages can be removed since they weren't doing anyting.
* `ANALYZE_FOR_ENTRY_COMPONENTS` injection token has been deleted. Any references can be removed.

PR Close #49484
2023-03-23 10:38:03 -07:00
Alan Agius
0e5f9ba6f4 fix(core): generate consistent component IDs (#48253)
Prior to this change the component IDs where generated based on a counter. This is problematic as there is no guarantee that a component will get the same ID that was assigned on the server when generated on the client side.

This is paramount to be able to re-use the component styles generated on the server.

PR Close #48253
2023-03-09 09:33:34 -08:00
Matthieu Riegler
2423a04092 docs: remove TODO from doc example (#49233)
This commit removes a TODO(issue/24571) that leaking into the docs examples

PR Close #49233
2023-02-28 08:19:56 -08:00
Andrew Scott
455c728525 feat(router): helper functions to convert class guards to functional (#48709)
This commit introduces helper functions to easily convert `Injectable`s with
functions compatible with `Route` guards to the corresponding guard functions.
These functions will serve to aid in migrating off of the now deprecated
class-based guards, but also provide an easy avenue to still defining
guards as `Injectable` classes if that is desired.

PR Close #48709
2023-02-27 11:52:47 -08:00
Andrew Kushnir
83a6e203e3 refactor(compiler): drop obsolete NgFactory and NgSummary config options (#48268)
The options to generate NgFactory and NgSummary files were added to Ivy for backwards compatibility with ViewEngine. Since ViewEngine was deprecated and removed, the NgFactory and NgSummary files are no longer used as well.

This commit drops obsolete options to generate NgFactory and NgSummary files. Also, the logic that generates those files is also removed.

PR Close #48268
2023-02-21 13:03:59 -08:00
Andrew Scott
f5a7e02529 docs(router): Update functional guard and resolver docs (#48873)
This commit updates the docs of the functional guards and resolvers to improve the migration
experience when moving away from class-based equivalents.

PR Close #48873
2023-02-02 13:39:32 -08:00
Andrew Scott
dedac8d3f7 feat(router): Add test helper for trigger navigations in tests (#48552)
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 #15779
resolves #48608

PR Close #48552
2023-01-25 19:31:38 +00:00
Paul Gschwendtner
623ca1f787 build: remove remaining usages of deprecated ts_devserver (#48521)
* Switches all remaining targets (even if not tested and failing as per
  build) away from `ts_devserver` to the canonical `http_server` from
  dev-infra.

PR Close #48521
2022-12-19 19:50:44 +00:00
Paul Gschwendtner
642d009501 refactor: switch packages/examples to ESM-compatible http server (#48521)
* Switches all examples to use dev-infra's canonical ESM-compatible
  `http_server`.
* Uses ESBuild for bundling ESM into a single file, compared to having
  to load hundreds of individual ESM files in the browser (potential
  source of flakiness & slowness).

PR Close #48521
2022-12-19 19:50:44 +00:00
Paul Gschwendtner
c9415e4d75 build: ensure bootstrap transitive runfiles are made available (#48521)
Since we generate a `.mjs` file as entry-point for jasmine tests,
a couple of issues prevented the transitive dependencies from
bootstrap targets to be brought in (causing resolution errors):

1. The `_files` (previously `_esm2015`) targets are no longer needed,
   and they also miss all the information on runfiles.
2. The aspect for computing linker mappings does not respect the
   `bootstrap` attribute from the `spec_entrypoint` so we manually
   add the extract ESM output targets (this rule works with the aspect
   and forwards linker mappings).

PR Close #48521
2022-12-19 19:50:41 +00:00
Paul Gschwendtner
20551503fa build: replace _es2015 shorthand with more flexible _files suffix (#48521)
For every `ts_library` target we expose a shorthand that grants
access to the JS files because `DefaultInfo` of a ts library
only exposes the `.d.ts` files.

We rename this away from `es2015` since in practice it's a much
higher target these days. Additionally we no longer use the devmode
output but rather use the prodmode output which has the explicit
`.mjs` output- compatible with ESM.

PR Close #48521
2022-12-19 19:50:41 +00:00
Derek Cormier
431c562815 build(bazel): add bazel targets for aio doc generation
This is an incremental step to produce dgeni output with bazel. The
generated outputs are not yet used by other targets.
2022-11-22 13:51:16 -07:00
Andrew Kushnir
120555a626 feat(core): support object-based DI flags in TestBed.inject() (#46761)
This commit applies the changes similar to the ones performed for the `inject()` function in df246bb235.

The `TestBed.inject` function is updated to use previously added object-based API for options: now the flags argument supports passing an object which configures injection flags.

DEPRECATED:

The bit field signature of `TestBed.inject()` has been deprecated, in favor of the new options object.

PR Close #46761
2022-09-27 10:09:53 -07: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
Kristiyan Kostadinov
359103274b test: clean up more entryComponents usages (#44561)
Cleans up some more tests that were using `entryComponents`.

PR Close #44561
2022-01-06 18:36:22 +00:00
Paul Gschwendtner
d60ebaa48a test: update example di tests to work with es2015 (#44505)
* `forwardRef` does not work with ES2015 and TypeScript's decorator
  downlevel emit. This is a known limitation we work around in Angular
  applications by either compiling tests with the Angular compiler, or
  by running a custom decorator downlevel transform (like in the CLI).

PR Close #44505
2022-01-05 23:20:21 +00:00
Paul Gschwendtner
c46d533b22 build: switch devmode output to es2015 (#44505)
To make our test output i.e. devmode output more aligned
with what we produce in the NPM packages, or to be more
aligned with what Angular applications will usually consume,
the devmode output is switched from ES5 to ES2015.

Additionally various tsconfigs (outside of Bazel) have been
updated to match with the other parts of the build. The rules
are:

ES2015 for test configurations, ES2020 for actual code that will
end up being shipped (this includes the IDE-only tsconfigs).

PR Close #44505
2022-01-05 23:20:20 +00:00
Alex Rickabaugh
43db24302c refactor(compiler): delete View Engine components of @angular/compiler (#44368)
This commit finishes the removal of View Engine from the codebase, deleting
those pieces of @angular/compiler which were only used for VE.

Co-Authored-By: JoostK <joost.koehoorn@gmail.com>

PR Close #44368
2021-12-06 13:12:36 -05:00
Andrew Kushnir
b31973c176 test: remove Ivy/ViewEngine switch helpers and obsolete tests (#44120)
This commit removes special functions that were used to run tests in ViewEngine or Ivy only.
Since ViewEngine is deprecated and we no longer run ViewEngine tests on CI, we can cleanup
those special helpers and ViewEngine-only tests.

PR Close #44120
2021-11-24 19:42:39 +00:00
dario-piotrowicz
f04a7c1d4d docs(core): apply minor improvements to the InjectionToken's api docs (#43693)
PR Close #43693
2021-10-13 16:46:26 +00:00
iRealNirmal
a502279592 feat(forms): allow minLength/maxLength validator to be bound to null (#42565)
If the validator is bound to be `null` then no validation occurs and
attribute is not added to DOM.

For every validator type different PR will be raised as discussed in
https://github.com/angular/angular/pull/42378.

Closes #42267.

PR Close #42565
2021-07-21 22:35:59 +00:00
Paul Gschwendtner
1dffa51808 refactor: ensure compatibility with noImplicitOverride for examples (#42512)
Adds the `override` keyword to the `examples` sources to ensure
compatibility with `noImplicitOverride`.

PR Close #42512
2021-07-12 13:11:16 -07:00
Paul Gschwendtner
b1fa1bf0d5 fix(dev-infra): ng_rollup_bundle rule should error if import cannot be resolved (#42760)
Rollup just prints a warning if an import cannot be resolved and ends up
being treated as an external dependency. This in combination with the
`silent = True` attribute for `rollup_bundle` means that bundles might
end up being extremely small without people noticing that it misses
actual imports.

To improve this situation, the warning is replaced by an error if
an import cannot be resolved.

This unveiles an issue with the `ng_rollup_bundle` macro from
dev-infra where imports in View Engine were not resolved but ended
up being treated as external. This did not prevent benchmarks using
this macro from working because the ConcatJS devserver had builtin
resolution for workspace manifest paths. Though given the new check
for no unresolved imports, this will now cause errors within Rollup, and
we need to fix the resolution. We can fix the issue by temporarily
enabling workspace linking. This does not have any performance
downsides.

To enable workspace linking (which we might need more often in the
future given the linker taking over patched module resolution), we
had to rename the `angular` dependency to a more specific one so
that the Angular linker could link into `node_modules/angular`.

PR Close #42760
2021-07-09 14:50:14 -07:00
Umair Hafeez
8a67770687 docs(core): improve applicationref.bootstrap docs (#42407)
add proper examples and update usage notes
add references to the method at relevant places in the docs

PR Close #42407
2021-06-22 16:30:37 +00:00
anups1
5c0541f351 docs: fix issue 24571 in ngOnChanges (#42517)
fix issue #24571 in ngOnChanges doc

PR Close #42517
2021-06-08 12:44:30 -07:00
Kristiyan Kostadinov
3e192bfa4d build: fix linting against jasmine focus functions (#42415)
We were linting against usages of `fdescribe` and `fit` by referencing the `no-jasmine-focus` rule which isn't installed, causing tslint to log the following:

```
Could not find implementations for the following rules specified in the configuration:
    no-jasmine-focus
Try upgrading TSLint and/or ensuring that you have all necessary custom rules installed.
If TSLint was recently upgraded, you may have old rules configured which need to be cleaned
```

These changes switch to using the built-in `ban` rule.

PR Close #42415
2021-06-01 10:16:55 -07:00
Pete Bacon Darwin
c2ed612da3 docs: convert the last my-app components to app-root (#42256)
Most of these were fixed in other PRs but there were are couple of stragglers.
Note that `my-app` components in non-documentation facing code, such as
compliance tests have not been changed.

Fixes #20235

PR Close #42256
2021-05-25 22:13:36 +00:00
Pete Bacon Darwin
bf505ad707 docs(core): tighten up PipeTransform example types (#42240)
The example was using `any` type but then assuming that the value was a string.

Fixes #42239

PR Close #42240
2021-05-24 17:08:34 +00:00
MrJithil
fc1bc0e0e8 docs: update examples to use correct Injector.create() overload (#42006)
The `Injector.create(providers, ...)` overload has been deprecated.
The examples now use the `Injector.create(options)` overload.

PR Close #42006
2021-05-17 10:53:28 -07:00
Kristiyan Kostadinov
de4fafb818 refactor(core): add single type for injector token (#41580)
Currently we have a lot of places where we repeat the type `Type<T>|AbstractType<T>|InjectionToken<T>` which makes it cumbersome to add another type or to type something else with the same signature.

These changes add a new type that can be used instead.

Fixes #39792.

PR Close #41580
2021-04-22 10:47:12 -07:00
Chris
bebdeba5fd docs: improve description, examples of DecimalPipe's digitsInfo parameter (#40714)
Fixes #40671

PR Close #40714
2021-02-26 15:42:29 -08:00
Chris
011a527497 docs: improve examples, description of PipeTransform (#40863)
Fixes #37321

PR Close #40863
2021-02-23 13:15:44 -08:00
Alexey Elin
e3c21c5465 docs: use TS Parameter properties in SkipSelf example (#40858)
PR Close #40858
2021-02-16 09:24:25 -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
Mitchell Wills
a1b6ad07a8 fix(core): Allow passing AbstractType to the inject function (#37958)
This is a type only change that replaces `Type<T>|InjectionToken<T>` with
`Type<T>|AbstractType<T>|InjectionToken<T>` in the injector.

PR Close #37958
2020-11-24 10:42:21 -08:00
Marcono1234
3e1e5a15ba docs: update links to use HTTPS as protocol (#39718)
PR Close #39718
2020-11-20 12:52:16 -08:00
Eduard Bondarenko
ad62edac9c docs: update forwardRef example (#39519)
Replace the deprecated api ReflectiveInjector.resolveAndCreat with Injector.create

PR Close #39519
2020-11-02 11:40:17 -08:00
Nihal
07a66fc4c2 docs: remove explicit boolean type in examples as TS infers it automatically (#39081)
In the `packages/examples/common/ngif/module.ts` file, the field `show` is given an explicit
boolean type. Since typescript infers boolean type, it is redundant and this commit removes it.

PR Close #39081
2020-10-06 08:39:01 -07:00