Sha256: 4ea5334cb39b507291467c7d5300cb78b01e306c04b34af49f8776f3acd18943
Contents?: true
Size: 1.6 KB
Versions: 2
Compression:
Stored size: 1.6 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.index'); } function error(response) { $scope.working = false; angular.forEach(response.data.errors, function (errors, field) { $scope.environmentForm[field].$setValidity('server', false); $scope.environmentForm[field].$error.messages = errors; }); } $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
2 entries across 2 versions & 1 rubygems