(function() { 'use strict'; angular .module('SportlogiqWebApp.directives') .directive('playlistCreatorModal', PlaylistCreatorModal); function PlaylistCreatorModal() { // Usage: // // Creates: // var directive = { templateUrl: 'views/playlistCreatorModal.html', controller: PlaylistCreatorModalController, restrict: 'E', scope: { context: '=', permissions: '=' } }; return directive; } PlaylistCreatorModalController.$inject = ['$rootScope', '$location', '$scope', 'userCompany', 'companies', 'playlistCreator']; /* @ngInject */ function PlaylistCreatorModalController ($rootScope, $location, $scope, userCompany, companies, playlistCreator) { var basePath = "playlist?id="; if ($scope.permissions.canShareWithAnyone) { $scope.companies = companies; $scope.companies.getAllCompanies(); $scope.companyId = $rootScope.companyId; } $scope.userCompany = userCompany; $scope.playlistCreator = playlistCreator; $scope.$watch('playlistCreator.newlyCreatedPlaylistId', function(newValue) { if (newValue) { $scope.currentPlaylistURL = $location.absUrl() + basePath + $scope.playlistCreator.newlyCreatedPlaylistId; } }); } })();