Skip to content

Instantly share code, notes, and snippets.

@aantipov
Created September 14, 2014 09:12
Show Gist options
  • Save aantipov/dfc1c10e0f7233aa7828 to your computer and use it in GitHub Desktop.
Save aantipov/dfc1c10e0f7233aa7828 to your computer and use it in GitHub Desktop.

Revisions

  1. aantipov created this gist Sep 14, 2014.
    33 changes: 33 additions & 0 deletions directve.transclude
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    '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));
    });
    };
    }
    };
    });