Attribute '{0}' of '{1}' is non-optional and must be set!
This error may occur only when $compileProvider.strictComponentBindingsEnabled
is set to true
.
If that is the case, then all component controller bindings and directive scope / controller bindings that are non-optional, must be provided when the directive is instantiated.
To make a binding optional, add '?' to the definition.
app.component('myTest', {
bindings: {
first: '=?', // optional
second: '='
},
controller: function() {
...
},
template: '...'
});
This component will throw missingattr
for the second
binding when used as follows:
<my-test></my-test>