mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor(core): update NG0303 error message (#62363)
This adds mention of the `input()` signal function to the error message. PR Close #62363
This commit is contained in:
committed by
Jessica Janiuk
parent
a06ec75735
commit
85d6474d8c
@@ -530,7 +530,7 @@ export class ComponentRef<T> extends AbstractComponentRef<T> {
|
||||
if (ngDevMode && !hasSetInput) {
|
||||
const cmpNameForError = stringifyForError(this.componentType);
|
||||
let message = `Can't set value of the '${name}' input on the '${cmpNameForError}' component. `;
|
||||
message += `Make sure that the '${name}' property is annotated with @Input() or a mapped @Input('${name}') exists.`;
|
||||
message += `Make sure that the '${name}' property is declared as an input using the @Input() decorator or the input() function.`;
|
||||
reportUnknownPropertyError(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ describe('ComponentFactory', () => {
|
||||
fixture.componentRef.setInput('doesNotExist', '');
|
||||
|
||||
const msgL1 = `NG0303: Can't set value of the 'doesNotExist' input on the 'NoInputsCmp' component. `;
|
||||
const msgL2 = `Make sure that the 'doesNotExist' property is annotated with @Input() or a mapped @Input('doesNotExist') exists.`;
|
||||
const msgL2 = `Make sure that the 'doesNotExist' property is declared as an input using the @Input() decorator or the input() function.`;
|
||||
expect(console.error).toHaveBeenCalledWith(msgL1 + msgL2);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user