vendredi 31 juillet 2015

How to Append multiple objects in to Nested JSON?

Aim:- To create Restaurant Business Hours for all days.

Steps I followed :-

1). Used Post method from service ($http.Post)

2). Binded UI Elements with ng-model. (

3). Used Post Method for every Tab

Output :- Seven Different Objects instead of Nested Json Object .

Could Any one Guys Give me some Ideas Or Sample Code for appending all the small Jsons in to Nested Json Like Following .

Plunker http://ift.tt/1IA9Zn1

Outputs:-

Actual Ouput Needed.

{
 displayName:"My Restaurnat BusinessHours"
    sun:{
         Opened:true,
         open:"10:00 Am",
         close:"10:00 PM"
          },
    mon:{
         Opened:true,
         open:"10:00 Am",
         close:"10:00 PM"
          },
    tue:{
         Opened:true,
         open:"10:00 Am",
         close:"10:00 PM"
          }

    }

Wrong Out Put :-

{
    displayName:"My Restaurnat BusinessHours"
sun:{
     Opened:true,
     open:"10:00 Am",
     close:"10:00 PM"
      } 
 }


 {
    displayName:"My Restaurnat BusinessHours"
mon:{
     Opened:true,
     open:"10:00 Am",
     close:"10:00 PM"
      } 
 }

 {
    displayName:"My Restaurnat BusinessHours"
tue:{
     Opened:true,
     open:"10:00 Am",
     close:"10:00 PM"
      } 
 }

Aucun commentaire:

Enregistrer un commentaire