model
Initializer API
model
declares a writeable signal that is exposed as an input/output
pair on the containing directive.
The input name is taken either from the class member or from the alias
option.
The output name is generated by taking the input name and appending Change
.
API
Usage Notes
function model<T>(): ModelSignal<T | undefined>;
Initializes a model of type T
with an initial value of undefined
.
Angular will implicitly use undefined
as initial value.
@returns
ModelSignal<T | undefined>
function model<T>(initialValue: T, opts?: ModelOptions | undefined): ModelSignal<T>;
Initializes a model of type T
with the given initial value.
@paraminitialValue
T
@returns
ModelSignal<T>
function model.required<T>(opts?: ModelOptions | undefined): ModelSignal<T>;
Initializes a required model.
Users of your directive/component need to bind to the input side of the model. If unset, a compile time error will be reported.
@returns
ModelSignal<T>
Jump to details