angular-docs-cn/packages/core/schematics/migrations/dynamic-queries
Alan Agius 8b5ca670ad refactor(core): update migrations descriptions (#33440)
With the next version of the CLI we don't need to add logging for the description of the schematic as part of the schematic itself.

This is because now, the CLI will print the description defined in the `migrations.json` file.

See: https://github.com/angular/angular-cli/pull/15951

PR Close #33440
2019-10-28 17:07:50 -07: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 refactor(core): update migrations descriptions (#33440) 2019-10-28 17:07:50 -07: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;
}