Bit confused about how to get Key and Value
of an object in angular2 while using *ngFor for iteration over the object. I know in angular 1.x there is syntax like
ng-repeat="(key, value) in demo"
but in angular2 I don't know I tried the same but didn't get successful. I have tried the below code but didn't run please tell me where I am doing wrong.
<ul> <li *ngFor='#key of demo'>{{key}}</li> </ul>demo = {
‘key1’: [{‘key11’:‘value11’}, {‘key12’:‘value12’}],
‘key2’: [{‘key21’:‘value21’}, {‘key22’:‘value22’}],
}
here is plnkr where I have tried the same : http://plnkr.co/edit/mIj619FncOpfdwrR0KeG?p=preview
I want to get key1
and key2
dynamically using *ngFor. How to get it? I searched a lot found the idea of using pipe but how to use I don’t know. is there any inbuild pipe for doing same in angular2?
#angular