(function () { "use strict"; var streamApp = angular.module('streamApp'); streamApp.directive('sharedTagsDirective', ['sharingService', 'groupsService', SharedTagsDirective]); function SharedTagsDirective(sharingService, groupsService) { return { restrict: 'E', scope: { name: '=', callback: '=', userId: '=', accepted: '=' }, templateUrl: '/App/Directives/sharedTagsDirective/sharedTagsDirective.html?v=6.0.0c', link: function (scope, element, attrs, tabsCtrl) { scope.message = "Congratulations, you are now able to share with " + scope.name + "!"; groupsService.getGroupsEditable().then(function (data) { scope.groups = sortName(data.data.activeTags); }); scope.continue = function () { const groups = scope.groups.filter(group => group.selected).map(tag => tag.tagId); if (groups.length) { sharingService.updateTag(scope.userId, groups); } scope.callback(); }; } }; } }());