arnaucube
arnaucube/openEventsPlatformAppPublic Self-hosted repository
openEventsPlatformApp/www/js/newEvent.js
www/js/newEvent.jsRaw
 1angular.module('app.newEvent', ['pascalprecht.translate'])
 2
 3.controller('NewEventCtrl', function($scope, $http, $ionicModal, $timeout, $ionicLoading, $filter) {
 4
 5    $scope.event={};
 6    $scope.event.categories=[{name: "prova"}];
 7    $scope.postEvent = function(){
 8        $http({
 9            url: urlapi + 'events',
10            method: "POST",
11            data: $scope.event
12        })
13        .then(function(data) {
14            window.location.href="#/app/events";
15        },
16        function(response) { // optional
17                // failed
18                console.log(response);
19        });
20    };
21});