Migrating to v8 changes ViewChild to VViewChild
See original GitHub issueIssue Analytics
- State:
- Created 4 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Static query migration guide - Angular
In preparation for this change, in version 8, we are migrating all applications and libraries to explicitly specify the resolution strategy for @ViewChild...
Read more >Angular v8 - @ViewChild static true or false - Stack Overflow
According to Angular's Changelog one core change is (and I quote):. "In Angular version 8, it's required that all @ViewChild and @ContentChild ...
Read more >Update to Angular Version 8 now! | juri.dev
When upgrading to v8, there's a small breaking change related to the @ViewChild and @ContentChild . The team tried to avoid it, ...
Read more >Understanding the ViewChild and ViewChildren decorators in ...
We will cover how to use the @ViewChild and @ViewChildren decorators, what their properties do, and how to specify their properties.
Read more >How should I use the new static option for @ViewChild in ...
With dynamic queries (static: false), the query resolves after either ngAfterViewInit() or ngAfterContentInit() for @ViewChild() and @ContentChild() ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@devversion I think this discussion should be moved in a new issue in the CLI repo.
As discussed offline, the problem/feature is indeed in the CLI because the
updateRecorder
methods such asinsertLeft
,remove
etc… accepts positions which are not offset by a BOM. This is because when a file has a BOM a different recorder will be used https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/schematics/src/tree/recorder.ts#L72 which caters for an addition offset/delta.The main reason for this is that when a developer is writing a schematic they shouldn’t need to compute the offset based if a file has a BOM or not and is handled out of the box.
Example
However this is unfortunate in the case if a ts SourceFile is used and one uses
getWidth
andgetStart
method they will already be offset by 1, which at the end it results in a double offset and hence the problem.