question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Migrating to v8 changes ViewChild to VViewChild

See original GitHub issue

Description

This might be connected to angular/angular-cli#14551 and angular/angular-cli#9712

After I ran the migration, all my ViewChild references turned into VViewChild.

Edit: I just noticed that this only happened to the files with UTF-8 encoding. The files encoded with UTF-8 BOM are good.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
alan-agius4commented, May 29, 2019

@devversion I think this discussion should be moved in a new issue in the CLI repo.

1reaction
alan-agius4commented, May 29, 2019

As discussed offline, the problem/feature is indeed in the CLI because the updateRecorder methods such as insertLeft, 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

recorder.insertLeft(5, 'true');

However this is unfortunate in the case if a ts SourceFile is used and one uses getWidth and getStart method they will already be offset by 1, which at the end it results in a double offset and hence the problem.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found