I forgot to mention that the service call is made on load. I just need to save the results object. tia
On Thursday, June 27, 2019 at 4:05:21 PM UTC-4, j_rough wrote: > > All I need to do is save this object data from the service call. Its > subscribe/observer. So it keeps displaying the treeview data. I need to > capture the data to make a comparison. I have the object output. I just > don't know how to save the results object? ITs a little confusing because > there are two item.types. thanks, > Get Objects Results > [ > {"type":"WORKFLOW","objects":[ > > {"id":"/workflow/Stacks","type":"Workflow","name":"Stacks","owner":"DocumentService","objects":[ > > {"id":"/workflow/Stacks/q:Scan","type":"Queue","name":"Scan","owner":null,"objects":[ > > {"id":"/workflow/Stacks/q:Scan/i:Single","type":"ItemType","name":"Single","owner":null,"objects":null},{"id":"/workflow/Stacks/q:Scan/i:Multi","type":"ItemType","name":"Multi","owner":null,"objects":null}]}]}]}, > {"type":"REPORTS","objects":[ > {"id":"/reports/Status","type":"Reports","name":"Status > Reports","owner":"ReportPortal","objects":[ > {"id":"/reports/Status/n:report_1","type":"Report","name":"Report > 1","owner":null,"objects":null},{"id":"/reports/Status/n:report_2","type":"Report","name":"Report > > 2","owner":null,"objects":null}]}]}] > > this.rmService.getObjects().subscribe(res => { > console.log('Get Objects Results '+ JSON.stringify(res)); > res.map(item => { > if (item.type == "WORKFLOW") { > let treeviewItems = item.objects[0].objects[0].objects.map(object => { > const data = { > text: object.name, > value: object.id > }; > return data; > }); > this.objectItem.push(new TreeviewItem({ > text: item.type, > value: 1, > collapsed: false, > children: [{ > text: item.objects[0].type, > value: item.id, > children: [{ > text: item.objects[0].objects[0].type, > value: item.id, > children: treeviewItems, > }], > }], > > })); > } > > if (item.type == "REPORTS") { > let treeviewItems = item.objects[0].objects.map(object => { > const data = { > text: object.name, > value: object.id > }; > return data; > }); > this.objectItem.push(new TreeviewItem({ > text: item.type, > value: 0, > collapsed: false, > children: [{ > text: item.objects[0].type, > value: item.id, > children: treeviewItems, > }], > })); > } > }); > }); > } > > -- 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 post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. To view this discussion on the web visit https://groups.google.com/d/msgid/angular/97aaaa11-4845-4669-83d1-07fb4749bdac%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.