redirect to registration-finished after submit
[angular-drzb] / app / js / controllers.js
1 'use strict';
2
3 /* Controllers */
4
5
6 function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $route) {
7
8         $scope.$routeParams = $routeParams;
9         $scope.$location = $location;
10
11         $scope.update = function(user) {
12                 user.$save();
13                 $log.info("saved", user);
14                 $location.path( '/registration-finished/' + $routeParams.registrationId );
15         }
16
17         $scope.reset = function() {
18                 if ( $routeParams.registrationId ) {
19                         $scope.user = new Registration();
20                         $scope.user.$get({ registrationId: $routeParams.registrationId });
21                         $log.info("get Registration", $scope.user);
22                 } else {
23                         $scope.user = new Registration();
24                         $log.info("new Registration", $scope.user);
25                 }
26                 
27                 $log.info( $routeParams.registrationId );
28         }
29
30         $scope.reset();
31 }
32 //RegistrationCtrl.$inject = [ '$scope', '$log' ];
33
34
35 function MyCtrl2() {
36 }
37 MyCtrl2.$inject = [];