// *contentElements* is also an array and should be treated as such
// The structure below should work for you

<div *ngFor="let version of result.versions">
    <span> {{ version?.attributes?.id }} </span>
    <span> {{ version?.attributes?.sequence }} </span>

    *<ul>
        <li *ngFor="let element of version.**contentElements">
         {{ element?.contentType }}
        </li>
    </ul>*

  </div>

On Wed, 24 Jun 2020 at 10:06, Sandeep Shukla <sandeep.shu...@gmail.com>
wrote:

> Thanks Nana. I got the values under attributes but under contenElements I
> dont get the values. Can I not reuse the same code as yours like this to
> get the data under contentElements
>   <div *ngFor="let version of result.versions">
>     <span> {{ version?.attributes?.id }} </span>
>     <span> {{ version?.attributes?.sequence }} </span>
>     <span> *{{ version?.contentElements?.contentType }}* </span> This
> does not work for me
>   </div>
>
> Regards
> Sandeep Shukla
>
> On Wed, Jun 24, 2020 at 10:54 AM NANA DARKO <kingsleydark...@gmail.com>
> wrote:
>
>> You can do this in your view or template:
>> It will loop through the array displaying  the data on the ui
>>
>>
>> <div *ngFor="let version of result.versions">
>> <span> {{ version?.attributes?.id }} </span>
>> <span> {{ version?.attributes?.sequence }} </span>
>> </div>
>>
>> On Wed, 24 Jun 2020 at 08:28, Sandeep Shukla <sandeep.shu...@gmail.com>
>> wrote:
>>
>>> I had already tried,does not ring a bell and I am not very good at
>>> frontend :)
>>>
>>> Already spent a week , I have developed the whole angular project but
>>> this I have encountered for the first time.
>>>
>>> May be if you could let me know the solution then I can build concept
>>> around it.
>>>
>>> Regards
>>> Sandeep Shukla
>>>
>>> On Wed, Jun 24, 2020 at 10:08 AM Manjari Singh <manjari.si...@gmail.com>
>>> wrote:
>>>
>>>> Versions is an array, [],content elements also array, index it,
>>>> beginning with 0,1.., you can play around on w3 schools json tutorial, try
>>>> it, for practice, and then correct your accessing
>>>>
>>>> On Wed, 24 Jun 2020 at 12:43 PM, sandeep...@gmail.com <
>>>> sandeep.shu...@gmail.com> wrote:
>>>>
>>>>> Thanks Manjari for your response. But it is not clear to me.
>>>>> in html I am saving json in result object like this in my TS file.
>>>>>          this.result = JSON.parse(JSON.stringify(data));
>>>>> In html I am trying to access
>>>>>      <div> {{result.document.title}} </div>   This works fine
>>>>>  <div> {{result.versions.attribute.versionnumber}} </div>     *I dont
>>>>> get this value* . Please look intot he structure of json
>>>>>
>>>>> Please share me what I am supposed to use to get correct reult. It is
>>>>> something related to traversing to the json object which I am not sure how
>>>>> to do it.
>>>>>
>>>>> Regards
>>>>> SandeepS hukla
>>>>> On Tuesday, June 23, 2020 at 5:59:20 PM UTC+2 manjar...@gmail.com
>>>>> wrote:
>>>>>
>>>>>> You have to index from versions , as per your current Json
>>>>>> Attributes , does not include cont...
>>>>>>
>>>>>> On Tue, 23 Jun 2020 at 8:39 PM, Sandeep Shukla <sandeep...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>> My json is
>>>>>>> {
>>>>>>>     "error": null,
>>>>>>>     "document": {
>>>>>>>         "title": "Hello World Angular",
>>>>>>>         "heading": "subject to changes"
>>>>>>>     },
>>>>>>>     "versions": [
>>>>>>>         {
>>>>>>>             "attributes": {
>>>>>>>                 "sequence": "1",
>>>>>>>                 "versionNumber": "1.6",
>>>>>>>                 "id": "A00100"
>>>>>>>             },
>>>>>>>             "contentElements": [
>>>>>>>                 {
>>>>>>>                     "contentType": "BASE",
>>>>>>>                     "mediaType": "text/xml",
>>>>>>>                     "fileName": null,
>>>>>>>                     "size": 779,
>>>>>>>                     "content": "This is content"
>>>>>>>                 },
>>>>>>>                 {
>>>>>>>                     "contentType": "NOTELOG",
>>>>>>>                     "mediaType": "text/plain",
>>>>>>>                     "fileName": null,
>>>>>>>                     "size": 29,
>>>>>>>                     "content": "Content2"
>>>>>>>                 }
>>>>>>>             ]
>>>>>>>         }
>>>>>>>     ]
>>>>>>> } How do i get the values in html under attributes,contentElements.
>>>>>>> I am unable to get it. Any help would be appreciated. I can handle 
>>>>>>> simple
>>>>>>> json but this is something not working for me. Regards Sandeep Shukla
>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Angular and AngularJS discussion" group.
>>>>>>>
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to angular+u...@googlegroups.com.
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msgid/angular/279d78ce-1cc3-45fe-a9cc-ea57eedacc9fo%40googlegroups.com
>>>>>>> <https://groups.google.com/d/msgid/angular/279d78ce-1cc3-45fe-a9cc-ea57eedacc9fo%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>> --
>>>>>> Sent from Gmail Mobile
>>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Angular and AngularJS discussion" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to angular+unsubscr...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/angular/2e27d9f8-1c33-475a-a2f3-5e88192ef7f0n%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/angular/2e27d9f8-1c33-475a-a2f3-5e88192ef7f0n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> Sent from Gmail Mobile
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Angular and AngularJS discussion" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to angular+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/angular/CAMF%2BC3pFQr8sUM716O1qEEfoAkKZzguvV6iAaZc5t_nyzhyyRw%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/angular/CAMF%2BC3pFQr8sUM716O1qEEfoAkKZzguvV6iAaZc5t_nyzhyyRw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
>>>
>>> --
>>> Regards
>>> Sandeep Shukla,
>>> Mobile# +31647969951
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Angular and AngularJS discussion" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to angular+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/angular/CAB0%2BwtAYORXzeaizaXjWS6KB4RE4DWVLfVRehj4jxFh1yMRwTQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/angular/CAB0%2BwtAYORXzeaizaXjWS6KB4RE4DWVLfVRehj4jxFh1yMRwTQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Angular and AngularJS discussion" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to angular+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/angular/CANd8XNvSbVy-NR4otqABRk5iN5sOW_NZDHqHk-Lmd4SDQFLkfA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/angular/CANd8XNvSbVy-NR4otqABRk5iN5sOW_NZDHqHk-Lmd4SDQFLkfA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> Regards
> Sandeep Shukla,
> Mobile# +31647969951
>
> --
> You received this message because you are subscribed to the Google Groups
> "Angular and AngularJS discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to angular+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/angular/CAB0%2BwtB7jAdLgRgyqNBj5Zg2rLAErB-LwJQo%3Des478MwNYOhDg%40mail.gmail.com
> <https://groups.google.com/d/msgid/angular/CAB0%2BwtB7jAdLgRgyqNBj5Zg2rLAErB-LwJQo%3Des478MwNYOhDg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/CANd8XNunrn5zx2VaLVR3paUW2DmVemixLbapieBXp4E%2BN8%3DNPA%40mail.gmail.com.

Reply via email to