I’m having issues with the input from the form not being sent to database.
the connection was ok but still doesnt updated in my database backand.
==========================================================
this is app.js
angular.module(‘app’, [‘ionic’, ‘app.controllers’, ‘app.routes’, ‘app.services’, ‘app.directives’,‘Backand’])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
});
})
.config(function (BackandProvider) {
BackandProvider.setAppName(‘careerpath’);
BackandProvider.setSignUpToken(‘0276854b-e76e-4571-aebb-7de86932cb97’);
BackandProvider.setAnonymousToken(‘94ab6a21-22ec-4e4e-b73e-57a7d1083120’);
})
here is my controller.js
angular.module(‘app.controllers’, [‘ionic’,‘app.services’,‘backand’])
.controller(‘homeCtrl’, function($scope) {
})
.controller(‘detailsJobsPosterCtrl’, function($scope) {
})
.controller(‘dashboardCtrl’, function($scope) {
})
.controller(‘loginShareJobCtrl’, function($scope) {
})
.controller(‘searchJobsCtrl’, function($scope) {
})
.controller (‘signupCtrl’,[’$scope’,‘signupservice’, function($scope,signupservice) {
$scope.Job_Poster = [];
$scope.input = {
username: $scope.username,
password: $scope.pass,
contactNo: $scope.phone
};
function getAllJob_Poster(){
signupservice.getJob_Poster().then(function(result){
$scope.Job_Poster = result.data.data;
});
};
$scope.addJob_Poster = function(){
signupservice.addJob_Posters($scope.input).then(function(result){
$scope.input = {};
});
getAllJob_Poster();
};
getAllJob_Poster();
}]);
here is my service.js
angular.module(‘app.services’, [‘app.controllers’,‘ionic’,‘backand’])
.factory(‘BlankFactory’, [function(){
}])
.service(‘BlankService’, [function(){
}])
.service(‘signupservice’, function ($http, Backand){
var baseUrl = '/1/objects/';
var objectName = 'Job_Poster/';
function getUrl(){
return Backand.getApiUrl() + baseUrl + objectName;
};
getJob_Poster = function(){
return $http.get(getUrl());
};
addJob_Poster = function(Job_Poster){
return $http.post(getUrl(),Job_Poster);
};
return {
getJob_Poster: getJob_Poster,
addJob_Poster: addJob_Poster
};
});
html page
<ion-view title="Signup" id="page3"> <ion-content overflow-scroll="true" padding="true" scroll="false" class="has-header"> <form ng-controller="signupCtrl" ng-model="input" name="signForm" class="list"> <div class="spacer" style="height: 100px;"></div> <ion-list> <label class="item item-input"> <span class="input-label">Username</span> <input type="text" ng-model="username" placeholder=""> </label> <label class="item item-input"> <span class="input-label">Password</span> <input type="text" ng-model="pass" placeholder=""> </label> <label class="item item-input"> <span class="input-label">Phone</span> <input type="tel" ng-model="phone" placeholder=""> </label> </ion-list> <a ng-click="addJob_Posters()" style="font-weight:;" class="button button-stable button-block">Sign up</a> </form> </ion-content> </ion-view>