Someone please solve my problem :Request header field Content-Type is not 
allowed by Access-Control-Allow-Headers.
the below code is* cors* using springs we set to accept:application/json on 
springs,

my url:http://localhost:8383/menu.html
server urls is:http://192.168.0.10:8080/com.laalsa.api/laalsa/add/category



    var menucategory = angular.module("menucategory", ['myApps']);
    menucategory.config(['$httpProvider', function($httpProvider) {


            $scope.menucategoryfunction = function(menuForm) {
                console.log("+++++++++" + angular.toJson($scope.menuForm));
                var data1 = {
                    category_name: "Hello world"
                };
                var jscon = JSON.stringify('category_name', 'hello world');
                var ssss = JSON.stringify({category_name: 'sandeep kumar 
jollu'});
                console.log("****" + ssss);

                var promise = $http({
                    "method": "post",
                    "url": 
"http://192.168.0.10:8080/com.laalsa.api/laalsa/add/category";,
                    data:$scope.menuForm,
                   data: {
                        category_name: menuForm.category_name
                    },
                    headers: {
                        "Content-Type": "application/json"
                });

                promise.success(function(data, status, headers, config, 
statusText) {
                    console.log("success:   " + JSON.stringify(data));
                    console.log("2:   " + JSON.stringify(status));
                    console.log("3:   " + JSON.stringify(headers));
                    console.log("4:   " + JSON.stringify(config));
                    console.log("statusText:   " + 
JSON.stringify(statusText));
                });
                promise.error(function(data, status, headers, config) {
                    console.log("data:   " + JSON.stringify(data));
                    console.log("status:   " + JSON.stringify(status) + 
status);
                    console.log("headers:   " + JSON.stringify(headers));
                    console.log("config:   " + JSON.stringify(config));
                });
            };
     }]);

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to