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

Commit

Permalink
feat(component): disallow non-isolate scopes
Browse files Browse the repository at this point in the history
Closes #13710
  • Loading branch information
Shahar Talmi authored and petebacondarwin committed Jan 8, 2016
1 parent 16ccac9 commit f31c5a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/ng/compile.js
Expand Up @@ -967,7 +967,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
* See {@link ng.$compile#-bindtocontroller- `bindToController`}.
* - `transclude` – `{boolean=}` – whether {@link $compile#transclusion content transclusion} is enabled.
* Disabled by default.
* - `isolate` – `{boolean=}` – whether the new scope is isolated. Isolated by default.
* - `restrict` - `{string=}` - a string containing one or more characters from {@link ng.$compile#-restrict- EACM},
* which restricts the component to specific directive declaration style. If omitted, this defaults to 'E'.
* - `$canActivate` – `{function()=}` – TBD.
Expand All @@ -982,7 +981,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
* directives. Component definitions usually consist only of a template and a controller backing it.
*
* In order to make the definition easier, components enforce best practices like use of `controllerAs`,
* `bindToController` and default behaviors like **isolate scope** and restriction to elements.
* `bindToController`, **isolate scope** and default behaviors like restriction to elements.
*
* Here are a few examples of how you would usually define components:
*
Expand Down Expand Up @@ -1071,7 +1070,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
template: makeInjectable(template),
templateUrl: makeInjectable(options.templateUrl),
transclude: options.transclude,
scope: options.isolate === false ? true : {},
scope: {},
bindToController: options.bindings || {},
restrict: options.restrict || 'E'
};
Expand Down
3 changes: 1 addition & 2 deletions test/ng/compileSpec.js
Expand Up @@ -9352,7 +9352,6 @@ describe('$compile', function() {
template: 'abc',
templateUrl: 'def.html',
transclude: true,
isolate: false,
bindings: {abc: '='},
restrict: 'EA'
});
Expand All @@ -9364,7 +9363,7 @@ describe('$compile', function() {
template: 'abc',
templateUrl: 'def.html',
transclude: true,
scope: true,
scope: {},
bindToController: {abc: '='},
restrict: 'EA'
}));
Expand Down

0 comments on commit f31c5a3

Please sign in to comment.