Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit 2004757

Browse files
committed
chore(tab): change to linking function
- Change to use linking function as the use of `transclude` on the compile has been deprecated by Angular Closes #4061
1 parent a9d3d25 commit 2004757

File tree

1 file changed

+33
-35
lines changed

1 file changed

+33
-35
lines changed

Diff for: src/tabs/tabs.js

+33-35
Original file line numberDiff line numberDiff line change
@@ -199,47 +199,45 @@ angular.module('ui.bootstrap.tabs', [])
199199
controller: function() {
200200
//Empty controller so other directives can require being 'under' a tab
201201
},
202-
compile: function(elm, attrs, transclude) {
203-
return function postLink(scope, elm, attrs, tabsetCtrl) {
204-
scope.$watch('active', function(active) {
205-
if (active) {
206-
tabsetCtrl.select(scope);
207-
}
208-
});
209-
210-
scope.disabled = false;
211-
if ( attrs.disable ) {
212-
scope.$parent.$watch($parse(attrs.disable), function(value) {
213-
scope.disabled = !! value;
214-
});
215-
}
216-
217-
// Deprecation support of "disabled" parameter
218-
// fix(tab): IE9 disabled attr renders grey text on enabled tab #2677
219-
// This code is duplicated from the lines above to make it easy to remove once
220-
// the feature has been completely deprecated
221-
if ( attrs.disabled ) {
222-
$log.warn('Use of "disabled" attribute has been deprecated, please use "disable"');
223-
scope.$parent.$watch($parse(attrs.disabled), function(value) {
224-
scope.disabled = !! value;
225-
});
202+
link: function(scope, elm, attrs, tabsetCtrl, transclude) {
203+
scope.$watch('active', function(active) {
204+
if (active) {
205+
tabsetCtrl.select(scope);
226206
}
207+
});
227208

228-
scope.select = function() {
229-
if ( !scope.disabled ) {
230-
scope.active = true;
231-
}
232-
};
209+
scope.disabled = false;
210+
if ( attrs.disable ) {
211+
scope.$parent.$watch($parse(attrs.disable), function(value) {
212+
scope.disabled = !! value;
213+
});
214+
}
233215

234-
tabsetCtrl.addTab(scope);
235-
scope.$on('$destroy', function() {
236-
tabsetCtrl.removeTab(scope);
216+
// Deprecation support of "disabled" parameter
217+
// fix(tab): IE9 disabled attr renders grey text on enabled tab #2677
218+
// This code is duplicated from the lines above to make it easy to remove once
219+
// the feature has been completely deprecated
220+
if ( attrs.disabled ) {
221+
$log.warn('Use of "disabled" attribute has been deprecated, please use "disable"');
222+
scope.$parent.$watch($parse(attrs.disabled), function(value) {
223+
scope.disabled = !! value;
237224
});
225+
}
238226

239-
//We need to transclude later, once the content container is ready.
240-
//when this link happens, we're inside a tab heading.
241-
scope.$transcludeFn = transclude;
227+
scope.select = function() {
228+
if ( !scope.disabled ) {
229+
scope.active = true;
230+
}
242231
};
232+
233+
tabsetCtrl.addTab(scope);
234+
scope.$on('$destroy', function() {
235+
tabsetCtrl.removeTab(scope);
236+
});
237+
238+
//We need to transclude later, once the content container is ready.
239+
//when this link happens, we're inside a tab heading.
240+
scope.$transcludeFn = transclude;
243241
}
244242
};
245243
}])

0 commit comments

Comments
 (0)