I gathered form data from 3 different controller and shared the data using a factory.
.factory('Data', function () {
return {
type: '',
location: '',
startDate: '',
endDate: '',
notes: '',
repeat: ''};
})
on the last page i want to be able to post using JSON.
since the
<form></form>
IS NOT present and i can’t use the “submit” function (or can I?).
What should my controller look like? (ng-click=“postToJSON()”)??
Below insert From: Ionic Tutorial on backend
angular.module('ionicApp', ['ionic', 'ngResource'])
.factory('Post', function($resource) {
return $resource('/api/post/:id');
})
.controller('MainCtrl', function($scope, Post) {
// Get all posts
$scope.posts = Post.query();
// Our form data for creating a new post with ng-model
$scope.postData = {};
$scope.newPost = function() {
var post = new Post($scope.postData);
post.$save();
}
});