diff --git a/docs/content/error/$compile/missingattr.ngdoc b/docs/content/error/$compile/missingattr.ngdoc index 1fb2a346b4a2..62e877e84f6f 100644 --- a/docs/content/error/$compile/missingattr.ngdoc +++ b/docs/content/error/$compile/missingattr.ngdoc @@ -3,6 +3,34 @@ @fullName Missing required attribute @description -This error may occur only when `$compileProvider.strictComponentBindingsEnabled` is set to `true`. -Then all attributes mentioned in `bindings` without `?` must be set. If one or more aren't set, -the first one will throw an error. +This error may occur only when {@link $compileProvider#strictComponentBindingsEnabled `$compileProvider.strictComponentBindingsEnabled`} is set to `true`. + +If that is the case, then all {@link $compileProvider#component component} controller bindings and +{@link $compileProvider#directive 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. + +## Example: + +```js + +app.component('myTest', { + bindings: { + first: '=?', // optional + second: '=' + }, + controller: function() { + ... + }, + template: '...' +}); + +``` + +This component will throw `missingattr` for the `second` binding when used as follows: + +```html + +``` + diff --git a/src/ng/compile.js b/src/ng/compile.js index ebfbc875ad5c..561bb13fef16 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -1415,16 +1415,19 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { * @ngdoc method * @name $compileProvider#strictComponentBindingsEnabled * - * @param {boolean=} enabled update the strictComponentBindingsEnabled state if provided, otherwise just return the - * current strictComponentBindingsEnabled state + * @param {boolean=} enabled update the strictComponentBindingsEnabled state if provided, + * otherwise return the current strictComponentBindingsEnabled state. * @returns {*} current value if used as getter or itself (chaining) if used as setter * * @kind function * * @description - * Call this method to enable/disable strict component bindings check. If enabled, the compiler will enforce that - * for all bindings of a component that are not set as optional with `?`, an attribute needs to be provided - * on the component's HTML tag. + * Call this method to enable / disable the strict component bindings check. If enabled, the + * compiler will enforce that all scope / controller bindings of a + * {@link $compileProvider#directive directive} / {@link $compileProvider#component component} + * that are not set as optional with `?`, must be provided when the directive is instantiated. + * If not provided, the compiler will throw the + * {@link error/$compile/missingattr $compile:missingattr error}. * * The default value is false. */