Sha256: fd0386c3c4727df419cdaac27afe0475bc3c73052421f33c26c9b9dc9da3a765
Contents?: true
Size: 1.84 KB
Versions: 10
Compression:
Stored size: 1.84 KB
Contents
(function () { 'use strict'; /** * @ngdoc controller * @name Bastion.environments.controller:NewEnvironmentController * * @description * Handles creating a new environment. */ function NewEnvironmentController($scope, Environment, FormUtils) { function success() { $scope.transitionTo('environments'); } function error(response) { $scope.working = false; angular.forEach(response.data.errors, function (errors, field) { if ($scope.environmentForm.hasOwnProperty(field)) { $scope.environmentForm[field].$setValidity('server', false); $scope.environmentForm[field].$error.messages = errors; } else { $scope.errorMessages.push(errors); } }); } $scope.errorMessages = []; $scope.successMessages = []; $scope.loading = true; $scope.environment = new Environment(); $scope.priorEnvironment = Environment.get({id: $scope.$stateParams.priorId}); $scope.priorEnvironment.$promise.then(function () { $scope.loading = false; }); $scope.save = function (environment) { environment['prior_id'] = $scope.$stateParams.priorId; environment.$save(success, error); }; $scope.$watch('environment.name', function () { if ($scope.environmentForm.name) { $scope.environmentForm.name.$setValidity('server', true); FormUtils.labelize($scope.environment); } }); } angular .module('Bastion.environments') .controller('NewEnvironmentController', NewEnvironmentController); NewEnvironmentController.$inject = ['$scope', 'Environment', 'FormUtils']; })();
Version data entries
10 entries across 10 versions & 1 rubygems