Hi I am trying to call Post web service from Angular JS. I am not getting the response instead getting below error.
TypeError: 'caller' and 'arguments' are restricted function properties and cannot be accessed in this context.
at Function.remoteFunction (<anonymous>:3:14)
at http://localhost:9000/scripts/factory/bookFactory.js:24:17
at processQueue (http://localhost:9000/bower_components/angular/angular.js:16170:28)
at http://localhost:9000/bower_components/angular/angular.js:16186:27
at Scope.$eval (http://localhost:9000/bower_components/angular/angular.js:17444:28)
at Scope.$digest (http://localhost:9000/bower_components/angular/angular.js:17257:31)
at Scope.$apply (http://localhost:9000/bower_components/angular/angular.js:17552:24)
at done (http://localhost:9000/bower_components/angular/angular.js:11697:47)
at completeRequest (http://localhost:9000/bower_components/angular/angular.js:11903:7)
at XMLHttpRequest.requestLoaded (http://localhost:9000/bower_components/angular/angular.js:11836:9)
Here is my Factory Code which all another Web Service to get Hotel Information.
'use strict';
/**
* @ngdoc function
* @name myappApp.factory:bookFactory
* @description
* # bookFactory
* Factory of the myappApp
*/
var app = angular.module('myappApp');
app.factory('bookFactory', function($http, viewFactory) {
var booked = [];
return {
bookingConf: function(id, userName, userAddress) {
viewFactory.getHotels(id).then(function(result) {
var request = $http({
method: 'POST',
url: 'http://hotelmgmt.mybluemix.net/book',
headers: {'Content-Type': 'application/json'},
data: '{"customer":{"name":"'+userName+'","address":{"address":"'+userAddress+'","location":"'+userAddress+'","zip":"'+userAddress+'"}},"hotel":{"id":"'+result.data.id+'","name":"'+result.data.name+'","address":{"address":"'+result.data.address.address+'","location":"'+result.data.address.location+'","zip":"'+result.data.address.zip+'"},"dayRate":"'+result.data.dayRate+'","nightRate":"'+result.data.nightRate+'"}}'
});
// Store the data-dump of the FORM scope.
request.success(
function( html ) {
return html;
}
);
});
}
};
});
Please help