Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 25bc531

Browse files
fix($compileProvider): remove the ability to set the restrict option on component() helper
Closes #13741
1 parent 4e1b36c commit 25bc531

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/ng/compile.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -968,21 +968,20 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
968968
* See {@link ng.$compile#-bindtocontroller- `bindToController`}.
969969
* - `transclude` – `{boolean=}` – whether {@link $compile#transclusion content transclusion} is enabled.
970970
* Disabled by default.
971-
* - `restrict` - `{string=}` - a string containing one or more characters from {@link ng.$compile#-restrict- EACM},
972-
* which restricts the component to specific directive declaration style. If omitted, this defaults to 'E'.
973971
* - `$canActivate` – `{function()=}` – TBD.
974972
* - `$routeConfig` – `{object=}` – TBD.
975973
*
976974
* @returns {ng.$compileProvider} the compile provider itself, for chaining of function calls.
977975
* @description
978-
* Register a **Component definition** with the compiler. This is a shorthand for registering a special
979-
* type of directive, which represents a self-contained UI component in your application.
976+
* Register a **component definition** with the compiler. This is a shorthand for registering a special
977+
* type of directive, which represents a self-contained UI component in your application. Such components
978+
* are always isolated (i.e. `scope: {}`) and are always restricted to elements (i.e. `restrict: 'E'`).
980979
*
981-
* Component definitions are very simple and do not require much of the complexity behind defining general
980+
* Component definitions are very simple and do not require as much configuration as defining general
982981
* directives. Component definitions usually consist only of a template and a controller backing it.
983982
*
984983
* In order to make the definition easier, components enforce best practices like use of `controllerAs`,
985-
* `bindToController`, **isolate scope** and default behaviors like restriction to elements.
984+
* `bindToController`. They always have **isolate scope** and are restricted to elements.
986985
*
987986
* Here are a few examples of how you would usually define components:
988987
*
@@ -1077,7 +1076,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
10771076
transclude: options.transclude,
10781077
scope: {},
10791078
bindToController: options.bindings || {},
1080-
restrict: options.restrict || 'E'
1079+
restrict: 'E'
10811080
};
10821081
}
10831082

test/ng/compileSpec.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9357,8 +9357,7 @@ describe('$compile', function() {
93579357
template: 'abc',
93589358
templateUrl: 'def.html',
93599359
transclude: true,
9360-
bindings: {abc: '='},
9361-
restrict: 'EA'
9360+
bindings: {abc: '='}
93629361
});
93639362
module('my');
93649363
inject(function(myComponentDirective) {
@@ -9370,7 +9369,7 @@ describe('$compile', function() {
93709369
transclude: true,
93719370
scope: {},
93729371
bindToController: {abc: '='},
9373-
restrict: 'EA'
9372+
restrict: 'E'
93749373
}));
93759374
});
93769375
});

0 commit comments

Comments
 (0)