Use a function that returns Object.keys to enumerate the keys. That's what I've done.
--
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 angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
woot = new Map(Object.entries({bought:true, returned:'no', superBrandId:true, partnerBrand:false}))--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/EtPS4FwcPWo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
Thanks for that. I suspected something like that would be possible.
______________________________________
p. stephen wille
Where there's a Wille, there's a way.
On Sat, Jul 30, 2016 at 11:57 PM, Sander Elias <sande...@gmail.com> wrote:
Hi P. Stephen,On Object is not an iteratable, but a map is. you can easily conver to one like this:woot = new Map(Object.entries({bought:true, returned:'no', superBrandId:true, partnerBrand:false}))
now woot is an iterable, you can easily traverse.RegardsSander
--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/EtPS4FwcPWo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+unsubscribe@googlegroups.com.
Could you put an example on plunkr? Even if it doesn't work, it will better explain what it is you are trying to do.
Anyone?
Is the question unclear?
On Sunday, July 31, 2016 at 7:33:53 AM UTC-7, p. stephen w wrote:
Sounds like I need to create the array/Map before I can loop over it. That presents a dilemma. If I'm looping over an array of objects many levels deep, how will I know which is the correct object for a given array index? The only way I can see to allow NG2 to iterate over nested objects is, to transform the whole JSON blob, turning objects into arrays so they are compatible with *ngFor.
Am I missing something, or is there a better way?
On Sunday, July 31, 2016 at 7:02:51 AM UTC-7, p. stephen w wrote:
Thanks for that. I suspected something like that would be possible.
______________________________________
p. stephen wille
Where there's a Wille, there's a way.
On Sat, Jul 30, 2016 at 11:57 PM, Sander Elias <sande...@gmail.com> wrote:
Hi P. Stephen,On Object is not an iteratable, but a map is. you can easily conver to one like this:woot = new Map(Object.entries({bought:true, returned:'no', superBrandId:true, partnerBrand:false}))
now woot is an iterable, you can easily traverse.RegardsSander
--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/EtPS4FwcPWo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
--
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 angular+u...@googlegroups.com.
import { Component } from 'angular2/core';
@Component({
selector: 'my-story',
template: `
<div *ngFor="#a of keys(woot)" ><span *ngIf="woot[a]">{{a |json}}</span></div>
`
})
export class StoryComponent {
woot = {bought:true, returned:'no', superBrandId:true, partnerBrand:false};
keys = Object.keys;
}
--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/EtPS4FwcPWo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
<my-trav [showData]="data"></my-trav><restform endpoint="api/client">
<validation field="name" required/>
<validation field="age" min="18"/>
</restform>