Skip to content
Permalink
Browse files

fix(loader): use `false` as default value for `transclude` in compone…

…nt 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`.
  • Loading branch information
sarod authored and petebacondarwin committed Dec 18, 2015
1 parent b0248b7 commit 6a47c0d75d0c6f0bfb3b5492d1f05ec900387744
Showing with 6 additions and 6 deletions.
  1. +3 −3 src/loader.js
  2. +3 −3 test/loaderSpec.js
@@ -318,7 +318,7 @@ function setupModuleLoader(window) {
* - `bindings` – `{object=}` – Define DOM attribute binding to component properties.
* Component properties are always bound to the component controller and not to the scope.
* - `transclude` – `{boolean=}` – Whether {@link $compile#transclusion transclusion} is enabled.
* Enabled by default.
* Disabled by default.
* - `isolate` – `{boolean=}` – Whether the new scope is isolated. Isolated by default.
* - `restrict` - `{string=}` - String of subset of {@link ng.$compile#-restrict- EACM} which
* restricts the component to specific directive declaration style. If omitted, this defaults to 'E'.
@@ -331,7 +331,7 @@ function setupModuleLoader(window) {
* definitions are very simple and do not require the complexity behind defining directives.
* Component definitions usually consist only of the template and the controller backing it.
* In order to make the definition easier, components enforce best practices like controllerAs
* and default behaviors like scope isolation, restrict to elements and allow transclusion.
* and default behaviors like scope isolation, restrict to elements.
*
* <br />
* Here are a few examples of how you would usually define components:
@@ -420,7 +420,7 @@ function setupModuleLoader(window) {
controllerAs: identifierForController(options.controller) || options.controllerAs || name,
template: makeInjectable(template),
templateUrl: makeInjectable(options.templateUrl),
transclude: options.transclude === undefined ? true : options.transclude,
transclude: options.transclude === undefined ? false : options.transclude,
scope: options.isolate === false ? true : {},
bindToController: options.bindings || {},
restrict: options.restrict || 'E'
@@ -121,7 +121,7 @@ describe('component', function() {
controllerAs: 'myComponent',
template: '',
templateUrl: undefined,
transclude: true,
transclude: false,
scope: {},
bindToController: {},
restrict: 'E'
@@ -136,7 +136,7 @@ describe('component', function() {
controllerAs: 'ctrl',
template: 'abc',
templateUrl: 'def.html',
transclude: false,
transclude: true,
isolate: false,
bindings: {abc: '='},
restrict: 'EA'
@@ -148,7 +148,7 @@ describe('component', function() {
controllerAs: 'ctrl',
template: 'abc',
templateUrl: 'def.html',
transclude: false,
transclude: true,
scope: true,
bindToController: {abc: '='},
restrict: 'EA'

0 comments on commit 6a47c0d

Please sign in to comment.
You can’t perform that action at this time.