/* Controllers */
-function RegistrationCtrl($scope, $log, Registration) {
- $scope.master = {};
+function RegistrationCtrl($scope, $log, Registration, $routeParams) {
+
+ $scope.$routeParams = $routeParams;
$scope.update = function(user) {
- $scope.master = angular.copy(user);
$log.info("saved", user, user.$save());
}
$scope.reset = function() {
- //$scope.user = angular.copy($scope.master);
- $scope.user = new Registration();
+ if ( $routeParams.registrationId ) {
+ $scope.user = new Registration();
+ $scope.user.$get({ registrationId: $routeParams.registrationId });
+ $log.info("get Registration", $scope.user);
+ } else {
+ $scope.user = new Registration();
+ $log.info("new Registration", $scope.user);
+ }
+
+ $log.info( $routeParams.registrationId );
}
$scope.reset();
-
}
//RegistrationCtrl.$inject = [ '$scope', '$log' ];