Created
September 14, 2014 09:12
-
-
Save aantipov/dfc1c10e0f7233aa7828 to your computer and use it in GitHub Desktop.
Example of directive with the use of transcludeFn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
angular.module('angularjs.module') | |
.directive('multiSelect', function ($modal, $templateCache, gettextCatalog) { | |
return { | |
restrict: 'A', | |
priority: 1000, | |
scope: { | |
dataLength: '@length', | |
title: '@' | |
}, | |
transclude: true, | |
templateUrl: '/components/common/multiSelect.html', | |
link: function (scope, iElement, attr, ctrl, transclude) { | |
iElement.find('.transcluded').append(transclude(scope.$parent, angular.noop)); | |
scope.showModal = function () { | |
var modal = $modal({ | |
title: scope.title || gettextCatalog.getString('Select options'), | |
template: '/components/common/multiSelectModal.html', | |
show: false | |
}); | |
modal.$promise.then(function () { | |
modal.show(); | |
$('#id-multiselect-modal .modal-body').append(transclude(scope.$parent, angular.noop)); | |
}); | |
}; | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment