angular-cn/packages/core/schematics/migrations/dynamic-queries
Kara Erickson f289411fa9 docs(core): add migration guide links to schematics (#33258)
Angular v9 schematics should print out a link to the migration
guide associated with each schematic. This way, users have an
easy way to find more information about the automatic code
transformations they will see with `ng update`.

PR Close #33258
2019-10-18 18:18:37 -04:00
..
BUILD.bazel feat(core): add dynamic queries schematic (#32231) 2019-09-11 19:14:03 -04:00
README.md feat(core): add dynamic queries schematic (#32231) 2019-09-11 19:14:03 -04:00
index.ts docs(core): add migration guide links to schematics (#33258) 2019-10-18 18:18:37 -04:00
util.ts feat(core): add dynamic queries schematic (#32231) 2019-09-11 19:14:03 -04:00

README.md

Dynamic queries migration

Automatically migrates dynamic queries to remove their static flag. This flag will no longer be necessary in version 9 for dynamic queries, as false is the default value.

Before

import { Directive, ViewChild, ContentChild, ElementRef } from '@angular/core';

@Directive()
export class MyDirective {
  @ViewChild('child', { static: false }) child: any;
  @ViewChild('secondChild', { read: ElementRef, static: false }) secondChild: ElementRef;
  @ContentChild('thirdChild', { static: false }) thirdChild: any;
}

After

import { Directive, ViewChild, ContentChild, ElementRef } from '@angular/core';

@Directive()
export class MyDirective {
  @ViewChild('child') child: any;
  @ViewChild('secondChild', { read: ElementRef }) secondChild: ElementRef;
  @ContentChild('thirdChild') thirdChild: any;
}