angular-cn/packages/compiler/src
Pete Bacon Darwin f535f31d78 fix(ivy): match attribute selectors for content projection with inline-templates (#29041)
The content projection mechanism is static, in that it only looks at the static
template nodes before directives are matched and change detection is run.
When you have a selector-based content projection the selection is based
on nodes that are available in the template.

For example:

```
<ng-content selector="[some-attr]"></ng-content>
```

would match

```
<div some-attr="..."></div>
```

If you have an inline-template in your projected nodes. For example:

```
<div *ngIf="..." some-attr="..."></div>
```

This gets pre-parsed and converted to a canonical form.

For example:

```
<ng-template [ngIf]="...">
  <div some-attr=".."></div>
</ng-template>
```

Note that only structural attributes (e.g. `*ngIf`) stay with the `<ng-template>`
node. The other attributes move to the contained element inside the template.

When this happens in ivy, the ng-template content is removed
from the component template function and is compiled into its own
template function. But this means that the information about the
attributes that were on the content are lost and the projection
selection mechanism is unable to match the original
`<div *ngIf="..." some-attr>`.

This commit adds support for this in ivy. Attributes are separated into three
groups (Bindings, Templates and "other"). For inline-templates the Bindings
and "other" types are hoisted back from the contained node to the `template()`
instruction, so that they can be used in content projection matching.

PR Close #29041
2019-03-07 11:27:36 -08:00
..
aot refactor: Consistently use index access on index signature types. (#28937) 2019-02-28 02:49:14 -08:00
compiler_util refactor(compiler): capture `sourceSpan` when converting action bindings to output AST (#28055) 2019-02-12 20:58:28 -08:00
css_parser build(bazel): Turning on strictPropertyInitialization for Angular. (#24572) 2018-06-25 07:57:13 -07:00
expression_parser fix(compiler): fix two existing expression transformer issues (#28523) 2019-02-13 19:13:10 -08:00
i18n refactor(compiler): use `options` argument for parsers (#28055) 2019-02-12 20:58:27 -08:00
jit refactor(compiler): wrap the jit evaluation in an injectable class (#28055) 2019-02-12 20:58:27 -08:00
ml_parser docs(compiler): correct lexer argument descriptions (#28978) 2019-02-28 02:44:19 -08:00
output refactor(compiler): wrap the jit evaluation in an injectable class (#28055) 2019-02-12 20:58:27 -08:00
render3 fix(ivy): match attribute selectors for content projection with inline-templates (#29041) 2019-03-07 11:27:36 -08:00
schema fix(core): size regression with closure compiler (#25531) 2018-08-30 21:22:40 -07:00
template_parser fix(ivy): incorrectly remapping certain properties that refer inputs (#28765) 2019-02-21 17:59:50 -08:00
view_compiler feat(core): allow users to define timing of ViewChild/ContentChild queries (#28810) 2019-02-19 12:56:25 -08:00
assertions.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
ast_path.ts style: typos fixed - https://github.com/vlajos/misspell-fixer (#22975) 2018-03-27 14:51:53 -04:00
chars.ts feat(compiler): support tokenizing escaped strings (#28055) 2019-02-12 20:58:27 -08:00
compile_metadata.ts feat(core): allow users to define timing of ViewChild/ContentChild queries (#28810) 2019-02-19 12:56:25 -08:00
compile_reflector.ts feat(ivy): @NgModule -> ngInjectorDef compilation (#22458) 2018-03-16 12:57:11 -07:00
compiler.ts fix(ivy): never use imported type references as values (#29111) 2019-03-05 16:47:41 -08:00
compiler_facade_interface.ts fix(ivy): support static ViewChild queries (#28811) 2019-02-19 15:29:00 -08:00
config.ts feat: add TypeScript 3 support (#25275) 2018-08-27 21:07:53 -04:00
constant_pool.ts feat(ivy): ICU support for Ivy (#26794) 2018-11-16 16:09:30 -08:00
core.ts refactor(ivy): define new `AttributeMarker.Template` marker (#29041) 2019-03-07 11:27:36 -08:00
directive_normalizer.ts refactor(compiler): use `options` argument for parsers (#28055) 2019-02-12 20:58:27 -08:00
directive_resolver.ts feat(compiler): narrow types of expressions used in *ngIf (#20702) 2017-12-08 10:24:26 -08:00
identifiers.ts feat(ivy): setClassMetadata() for assigning decorator metadata (#26860) 2018-10-31 19:52:36 -04:00
injectable_compiler.ts feat(ivy): support injection even if no injector present (#23345) 2018-04-13 14:29:52 -07:00
injectable_compiler_2.ts feat(ivy): compile @Injectable on classes not meant for DI (#28523) 2019-02-13 19:13:10 -08:00
jit_compiler_facade.ts fix(ivy): support dynamic host attribute bindings (#29033) 2019-03-01 15:18:13 -08:00
lifecycle_reflector.ts feat(ivy): implement TestBed (#25369) 2018-08-14 11:58:47 -07:00
metadata_resolver.ts feat(core): allow users to define timing of ViewChild/ContentChild queries (#28810) 2019-02-19 12:56:25 -08:00
ng_module_compiler.ts feat(compiler): lower @NgModule ids if needed (#23031) 2018-03-28 09:15:16 -07:00
ng_module_resolver.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
parse_util.ts fix(ivy): verify Host Bindings and Host Listeners before compiling them (#28356) 2019-01-29 16:36:22 -08:00
pipe_resolver.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
provider_analyzer.ts feat: change @Injectable() to support tree-shakeable tokens (#22005) 2018-02-12 14:34:59 -08:00
resource_loader.ts refactor(compiler): allow sync AOT compilation (#16832). 2017-05-23 10:41:23 -06:00
selector.ts feat(ivy): add generics to the SelectorMatcher API (#26203) 2018-10-04 10:11:17 -07:00
shadow_css.ts fix(compiler): Don't strip `/*# sourceURL ... */` (#16088) 2018-01-24 12:35:30 -08:00
style_compiler.ts feat(ivy): bridge component styles into the component renderer (#25255) 2018-08-23 16:51:15 -04:00
style_url_resolver.ts fix(compiler): Don't strip CSS source maps 2017-08-15 16:30:09 -07:00
summary_resolver.ts fix(compiler): allow to use flat modules and summaries 2017-09-28 14:20:20 -07:00
url_resolver.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
util.ts fix(core): Remove static dependency from @angular/core to @angular/compiler (#26734) 2018-10-31 14:15:06 -04:00
version.ts style: remove empty comments (#23404) 2018-05-10 15:48:13 -07:00