I'm learning AngularJS and so far I'm enjoying the framework, but there has been a snag I hit that has really got my wheels spinning and I need some help.
I have a form that I want to submit to some server-side code but when it gets to the server side code, it states that no POST data is present, further more, doing a console.log does nothing to help as whenever I add it, it doesn't show up in my firebug console. I've looked all around and tried everything but am stuck.
My AngularJS Code:
var AdminApp = angular.module('AdminApp', ['ui.router']);
// configure our routes
AdminApp.config(function($locationProvider, $stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/main');
$stateProvider.state('main', {
url: '/main',
templateUrl: 'Content/index.html',
controller: 'mainController'
});
AdminApp.controller('mainController', function($scope, $http) {
$scope.message = 'test';
//load up our notes.
$http.get('Server/companyNotes.php?companyId=1').success(function(data) {
$scope.notes = data;
$scope.loading = false;
});
$scope.processForm = function() {
$http({
url: "Server/addNote.php",
data: $scope.form,
method: 'POST',
headers : {'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8'}
}).success(function(data){
alert('sent!');
});
};
});
My html form:
<form name="addNote" ng-submit="processForm()">
<textarea id="notes" name="notes" ng-model="form.note"></textarea><br>
<input type="hidden" name="companyId" id="companyId" value="1" ng-model="form.companyId">
<input type="hidden" name="added_by" id="added_by" value="Demo User" ng-model="form.added_by">
<button type="submit" class="btn btn-sm btn-primary">Add Note</button>
</form>
I do have ng-app setup on my html tag.
I've tried several things and its simply frustrating me. I hope someone can help me figure this out as I'm must be doing something wrong and not seeing it.
Thanks
EDIT: It seems Summernote is the problem for the case of my textarea not working.