Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm newbie to Angular Js.I would like to Create Complex Json Object for my Xml settings Like string Jsonobject=" {'Email': { 'UserName': 'a','Password': 'a'}}"; So far I tried

$scope.save = function () {

                var AddSettings = $resource('../AddSettings/');--Calling my WCF REST SERVICE

                var adminSettings = new AddSettings();

                adminSettings.Title = $scope.inputtitle;
                adminSettings.HomeUrl = $scope.intputhomeurl;

                //var arr = [];
                //arr.push(addmodule.Title);
                //arr.push(addmodule.HomeUrl);
                //addmodule.LogoSettings = arr;



                adminSettings.$save();

It's generating following Json Object : { "UserName": "a","Password": "a"},Can any one please guide me to create a json Object like " {'Email': { 'UserName': 'a','Password': 'a'}}" using Angular js.

Thanks in advance

share|improve this question

1 Answer

up vote 0 down vote accepted

I solved my problem in the following way.

var adminSettings = new AddSettings();
adminSettings.LogoSettings = {
                    Title: $scope.inputtitle,
                    HomeUrl: $scope.intputhomeurl,
                    logo: $("#ImageUpload > img").attr('src')
                };
adminSettings.$save();

It's returning Json object as {'Email': { 'UserName': 'a','Password': 'a'}}.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.