Joined November 2017
·

mistyn8

nice simply explanation.. wondered if you had encountered 3rd party code where you needed to override a function nested in the link function..

(function () {
'use strict';
function UmbTabsNavDirective($timeout) {
function link(scope, el, attr) {
function activate() {
$timeout(function () {
//use bootstrap tabs API to show the first one
el.find('a:first').tab('show');
//enable the tab drop
el.tabdrop();
});
}
var unbindModelWatch = scope.$watch('model', function (newValue, oldValue) {
activate();
});
scope.$on('$destroy', function () {
//ensure to destroy tabdrop (unbinds window resize listeners)
el.tabdrop('destroy');
unbindModelWatch();
});

}
var directive = {
restrict: 'E',
replace: true,
templateUrl: 'views/components/tabs/umb-tabs-nav.html',
scope: {
model: '=',
tabdrop: '=',
idSuffix: '@'
},
link: link
};
return directive;
}
angular.module('umbraco.directives').directive('umbTabsNav', UmbTabsNavDirective);
}());

I want to override fnct active to change to el.find('a:not(:hidden):first').tab('show');

but can only seem to do it by having to completely override the link function.. eg don't return link.apply(this, arguments);
?????

Achievements
1 Karma
0 Total ProTip Views