angular-cn/packages/core/schematics/migrations/template-var-assignment
Paul Gschwendtner 349935a434 fix(core): migrations not always migrating all files (#30269)
In an Angular CLI project scenario where projects only reference
top-level source-files through the `tsconfig` `files` option, we currently
do not migrate referenced source-files. This can be fixed checking all
referenced source-files which aren't coming from an external library.

This is similar to how `tslint` determines project source-files.

PR Close #30269
2019-05-08 11:54:33 -07:00
..
angular refactor(core): template-var-assignment migration incorrectly warns (#30026) 2019-04-22 11:16:19 -07:00
google3 fix(core): static-query migration should not prompt if no queries are used (#30254) 2019-05-08 09:22:48 -07:00
BUILD.bazel feat(core): template-var-assignment update schematic (#29608) 2019-04-02 15:47:32 -07:00
README.md refactor(core): polish failure messages for template-var-assignment schematic (#29708) 2019-04-08 09:46:57 -07:00
analyze_template.ts refactor(core): template-var-assignment migration incorrectly warns (#30026) 2019-04-22 11:16:19 -07:00
index.ts fix(core): migrations not always migrating all files (#30269) 2019-05-08 11:54:33 -07:00

README.md

Assignments to template variables

With Ivy, assignments to template variables are no longer supported as template variables are effectively constants.

This means that assignments to template variables will break your application once Ivy is enabled by default. For example:

<button *ngFor="let option of options"
       (click)="option = 'newButtonText'">
  {{ option }}
</button>

In the example from above, a value is assigned to the option template variable on click. This will ultimately break your application and therefore the logic needs to be adjusted to not update the option variable, but rather the given element in the options array:

<button *ngFor="let option of options; let idx = index"
       (click)="options[idx] = 'newButtonText'">
  {{ option }}
</button>