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

Commit 6a47c0d

Browse files
sarodpetebacondarwin
authored andcommitted
fix(loader): use false as default value for transclude in component helper
The default value of for transclude in component helper is now `false`. The change is motivated by the fact that using `transclude: true` when not necessary made component unusable in conjunction with structural directives that also require transclusion such as `ng-switch-when` and `ng-repeat`. Closes #13566 Closes #13581 BREAKING CHANGE: Angular 1.5.0.beta.2 introduced the `module.component` helper where `transclude` was true by default. This changes the default for `transclude` to `false`. If you created components that expected transclusion then you must change your code to specify `transclude: true`.
1 parent b0248b7 commit 6a47c0d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/loader.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ function setupModuleLoader(window) {
318318
* - `bindings` – `{object=}` – Define DOM attribute binding to component properties.
319319
* Component properties are always bound to the component controller and not to the scope.
320320
* - `transclude` – `{boolean=}` – Whether {@link $compile#transclusion transclusion} is enabled.
321-
* Enabled by default.
321+
* Disabled by default.
322322
* - `isolate` – `{boolean=}` – Whether the new scope is isolated. Isolated by default.
323323
* - `restrict` - `{string=}` - String of subset of {@link ng.$compile#-restrict- EACM} which
324324
* restricts the component to specific directive declaration style. If omitted, this defaults to 'E'.
@@ -331,7 +331,7 @@ function setupModuleLoader(window) {
331331
* definitions are very simple and do not require the complexity behind defining directives.
332332
* Component definitions usually consist only of the template and the controller backing it.
333333
* In order to make the definition easier, components enforce best practices like controllerAs
334-
* and default behaviors like scope isolation, restrict to elements and allow transclusion.
334+
* and default behaviors like scope isolation, restrict to elements.
335335
*
336336
* <br />
337337
* Here are a few examples of how you would usually define components:
@@ -420,7 +420,7 @@ function setupModuleLoader(window) {
420420
controllerAs: identifierForController(options.controller) || options.controllerAs || name,
421421
template: makeInjectable(template),
422422
templateUrl: makeInjectable(options.templateUrl),
423-
transclude: options.transclude === undefined ? true : options.transclude,
423+
transclude: options.transclude === undefined ? false : options.transclude,
424424
scope: options.isolate === false ? true : {},
425425
bindToController: options.bindings || {},
426426
restrict: options.restrict || 'E'

test/loaderSpec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ describe('component', function() {
121121
controllerAs: 'myComponent',
122122
template: '',
123123
templateUrl: undefined,
124-
transclude: true,
124+
transclude: false,
125125
scope: {},
126126
bindToController: {},
127127
restrict: 'E'
@@ -136,7 +136,7 @@ describe('component', function() {
136136
controllerAs: 'ctrl',
137137
template: 'abc',
138138
templateUrl: 'def.html',
139-
transclude: false,
139+
transclude: true,
140140
isolate: false,
141141
bindings: {abc: '='},
142142
restrict: 'EA'
@@ -148,7 +148,7 @@ describe('component', function() {
148148
controllerAs: 'ctrl',
149149
template: 'abc',
150150
templateUrl: 'def.html',
151-
transclude: false,
151+
transclude: true,
152152
scope: true,
153153
bindToController: {abc: '='},
154154
restrict: 'EA'

0 commit comments

Comments
 (0)