0
Given the interface:
export interface Pergunta {
id: number
titulo: string
opcoes:[]
}
I want the options array to receive its options array:
{
"id": "1",
"titulo": "Qual o seu comportamento em relação aos seus investimentos?",
"opcoes": [
{
"description": "Preservar meu dinheiro sem correr risco"
},
{
"description": "Ganhar mais dinheiro, assumindo riscos moderados"
},
{
"description": "Ganhar mais dinheiro, assumindo riscos agressivo"
}
]
},
Yes, you are declaring a numeric value as String.... @Marcus Dacorréggio is correct.
– Ramos
Marcus pq a public opcoes: Array<Typodeopcoes>; would be wrong?
– Tiago Tiede
@How I call this array options in question array *ngfor ?
– ttlelis_12
If you are using Angular 2+ you can call using
*ngFor="let opcao of pergunta.opcoes"
– Marcus Hert da Coregio
Type <Section class="content"> <div class="Row"> <div *ngFor="Let question of questions" class="col-Sm-6 col-Xs-12"> <app-question [question]="></app-question> </div> </div> </Section>
– ttlelis_12
Inside of your Component
app-pergunta
you will probably have theapp-pergunta-opcao
or something, in which you will use *ngFor I passed above– Marcus Hert da Coregio
@Tiagotiede I believe that for Angular to make the object deserialize the
Array
would not serve, would have to beTipoDeOpcoes[]
– Marcus Hert da Coregio
I understand. The strange thing that I made a pocket and it was without stress here. Well the important thing is to learn and help the friend :D
– Tiago Tiede