- added example feature
This commit is contained in:
Luke Vella 2015-02-09 20:33:53 +01:00
parent 2e6131bc7b
commit 6877e92a1d
6 changed files with 66 additions and 9 deletions

View file

@ -23,8 +23,10 @@ angular.module('rallly')
$scope.submit = function(){
if ($scope.form.$valid && $scope.page == states.length){
$http.post('/api/event', $scope.event)
.success(function(event, status, headers, config){
console.log(JSON.stringify($scope.event));
var newEvent = new Event($scope.event);
newEvent.$save()
.then(function(event){
$scope.event = event;
$scope.eventUrl = $state.href('event', {
id: $scope.event._id
@ -33,8 +35,7 @@ angular.module('rallly')
});
$scope.page++;
$state.go('newevent.success');
})
.error(function(){
}, function(){
var modal = new ConfirmModal({
title : 'Uh oh!',
message : 'There was an error creating your event. Please try again later.',