I’m trying to use a ModelSignal in an Angular 18 application but compiler complains with
Can't bind to test since it is not provided by any applicable directives
.
I checked the documentation but couldn’t find any difference with what I have…
Since I was not able to make ModelSignal work, I tried to use a combination of InputSignal and OutputEmitter but the output one is not recognized.
Node v20.14.0
Angular CLI 18.0.3
Default configuration
My component looks like:
import {Component, input, model, output} from '@angular/core';
@Component({
selector: 'app-test',
standalone: true,
imports: [],
templateUrl: './test.component.html'
})
export class TestComponent {
test = model<number>(0);
in = input<number>(0);
ou = output<number>();
}
And my parent component’s template looks like:
<app-test [in]="1" (ou)="foo($event)" [(test)]="test" />
[in] is properly recognized but both (ou) and [(test)] are not recognized and fail on compilation.
Any clue on why it is not working?
Alkon23 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.