Defines a model property, with an optional default value
if the input snapshot / model creation data is null
or undefined
.
You should only use this with primitive values and never with object values
(array, model, object, etc).
Example:
x: prop(10) // an optional number, with a default value of 10
Default primitive value.
Defines a model property with no default value.
Example:
x: prop<number>() // a required number
x: prop<number | undefined>() // an optional number, which defaults to undefined
Defines a model property, with an optional function to generate a default value if the input snapshot / model creation data is
null
orundefined
.Example: