- This topic has 3 replies, 3 voices, and was last updated 6 years, 11 months ago by Brian Fernandes.
-
AuthorPosts
-
Fedor LosevParticipantExample:
If we have input x on a component and
<component [x]=1>
in another, and remove x from the component class, no warning ‘Cant bind to target` appears until full rebuild or template edit/save.As a subcase, to get autocomplete on new fields one needs to re-save template to trigger re-validation.
support-swapnaModeratorFedor,
Sorry that you are seeing this issue. I could not replicate the problems at my end.
I have added the@Input() x: number;
to the app.component.ts file and referenced it in the app.component.html file as below :<app-root [x]=1> </app-root>
When I remove the x or delete the entire @Input() line from the app.component.ts file and save it, I see the x in the app.component.html being validated and marked with
Can't bind to 'x' since it isn't a known property of 'app-root'
. I didn’t have to trigger a save or edit/save the app.component.html to get the validation right.Regarding autocomplete for new field, I added a new array or a variable to the app.component.ts file and saved it. Once done, I invoked content assist in the *ngFor and I do see the newly added fields listed.
If you are following different steps, then please share with us the details along with code snippets to help us replicate the problem at our end.
–Swapna
MyEclipse Support
Fedor LosevParticipantHi, I already mentioned different steps, you need two components to reproduce, what doesn’t re-validate for me is the template of parent component (that didn’t change) containing another component (that did change).
Create componentX containing <componentY [someprop]=’abc’>, remove someprop from componentY.ts without touching componentX template – no error until rebuild or componentX changes.
test-a.html :
<app-test-b [x]="1"></app-test-b>
test-b.ts:
@Input() x: number; constructor() { }
Leave only test-b.ts open, as you remove/add in test-b.ts
@Input() x: number;
without touching other files, errors are sometimes shown sometimes not (on remove) or sometimes disappear sometimes not (on add) depending on the build state.
Brian FernandesModeratorFedor,
Thanks for the additional details – I could reproduce this rather simply; I’m sure we could do something smarter here.
-
AuthorPosts