Skip to content

Commit f31c5a3

Browse files
Shahar Talmipetebacondarwin
Shahar Talmi
authored andcommitted
feat(component): disallow non-isolate scopes
Closes angular#13710
1 parent 16ccac9 commit f31c5a3

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/ng/compile.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
967967
* See {@link ng.$compile#-bindtocontroller- `bindToController`}.
968968
* - `transclude` – `{boolean=}` – whether {@link $compile#transclusion content transclusion} is enabled.
969969
* Disabled by default.
970-
* - `isolate` – `{boolean=}` – whether the new scope is isolated. Isolated by default.
971970
* - `restrict` - `{string=}` - a string containing one or more characters from {@link ng.$compile#-restrict- EACM},
972971
* which restricts the component to specific directive declaration style. If omitted, this defaults to 'E'.
973972
* - `$canActivate` – `{function()=}` – TBD.
@@ -982,7 +981,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
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` and default behaviors like **isolate scope** and restriction to elements.
984+
* `bindToController`, **isolate scope** and default behaviors like restriction to elements.
986985
*
987986
* Here are a few examples of how you would usually define components:
988987
*
@@ -1071,7 +1070,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
10711070
template: makeInjectable(template),
10721071
templateUrl: makeInjectable(options.templateUrl),
10731072
transclude: options.transclude,
1074-
scope: options.isolate === false ? true : {},
1073+
scope: {},
10751074
bindToController: options.bindings || {},
10761075
restrict: options.restrict || 'E'
10771076
};

test/ng/compileSpec.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -9352,7 +9352,6 @@ describe('$compile', function() {
93529352
template: 'abc',
93539353
templateUrl: 'def.html',
93549354
transclude: true,
9355-
isolate: false,
93569355
bindings: {abc: '='},
93579356
restrict: 'EA'
93589357
});
@@ -9364,7 +9363,7 @@ describe('$compile', function() {
93649363
template: 'abc',
93659364
templateUrl: 'def.html',
93669365
transclude: true,
9367-
scope: true,
9366+
scope: {},
93689367
bindToController: {abc: '='},
93699368
restrict: 'EA'
93709369
}));

0 commit comments

Comments
 (0)