redirect to registration-finished after submit
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 7 Dec 2012 16:20:35 +0000 (17:20 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 7 Dec 2012 16:20:35 +0000 (17:20 +0100)
app/js/app.js
app/js/controllers.js
app/partials/registration-finished.html [new file with mode: 0644]

index 06cb7d0..b91b652 100644 (file)
@@ -6,6 +6,7 @@ angular.module('myApp', ['myApp.filters', 'myApp.services', 'myApp.directives'])
   config(['$routeProvider', function($routeProvider) {
     $routeProvider.when('/registration', {templateUrl: 'partials/registration.html', controller: RegistrationCtrl});
     $routeProvider.when('/registration/:registrationId', {templateUrl: 'partials/registration.html', controller: RegistrationCtrl});
+    $routeProvider.when('/registration-finished/:registrationId', {templateUrl: 'partials/registration-finished.html', controller: RegistrationCtrl});
     $routeProvider.when('/view2', {templateUrl: 'partials/partial2.html', controller: MyCtrl2});
     $routeProvider.otherwise({redirectTo: '/registration'});
   }]);
index 122746a..5441d28 100644 (file)
@@ -3,12 +3,15 @@
 /* Controllers */
 
 
-function RegistrationCtrl($scope, $log, Registration, $routeParams) {
+function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $route) {
 
        $scope.$routeParams = $routeParams;
+       $scope.$location = $location;
 
        $scope.update = function(user) {
-               $log.info("saved", user, user.$save());
+               user.$save();
+               $log.info("saved", user);
+               $location.path( '/registration-finished/' + $routeParams.registrationId );
        }
 
        $scope.reset = function() {
diff --git a/app/partials/registration-finished.html b/app/partials/registration-finished.html
new file mode 100644 (file)
index 0000000..584a5c7
--- /dev/null
@@ -0,0 +1,28 @@
+
+<div ng-controller="RegistrationCtrl" name="RegistrationForm">
+
+Registration for
+
+{{user.firstname}}
+{{user.surname}}
+{{user.organization}}
+{{user.email}}
+
+
+Received, thanks.
+
+<pre>
+user={{user}}
+
+$routeParams={{$routeParams}}
+
+{{RegistrationForm.$valid}}
+{{RegistrationForm.$error}}
+
+location={{$location}}
+
+</pre>
+
+</div>
+
+