(function () { "use strict"; var streamApp = angular.module('streamApp'); streamApp.directive('timelineAddDirective', ['timelineService', '$window', '$routeParams', TimelineAddDirective]); function TimelineAddDirective(timelineService, $window, $routeParams) { return { restrict: 'E', scope: { callback: '=', ngTitle: '@' }, templateUrl: '/App/Directives/timelines/timelineAddDirective/timelineAddDirective.html?v=6.0.0c', link: function (scope, element, attrs, tabsCtrl) { scope.saveAction = "Create"; scope.first = $routeParams.first; scope.submit = function () { if (scope.name && scope.name.length > 1) { timelineService.add(scope.name, scope.description) .then((data) => { if (scope.callback) { scope.callback(data.Id); } else { scope.cancel(); } }); } } scope.cancel = function () { scope.name = ''; scope.description = ''; $window.history.back(); } } }; } }());