Mixing two list in ionic3


#1

Hello everybody.

I have two list, complementaries. The values nulled in list one are getting in list two.

this is my code

<p *ngFor="let field of block.fields">
  <b>{{field.label}}: </b><br>
  <span [hidden]="!field.value.label">{{field.value.label}}</span>
  <span [hidden]="field.value.label">{{ticket.{{field.value.fieldname}}}}</span>
</p>

block.fields is the list one, and the value are stored in field.value.label iteration, and the field name are store in field.value.fieldname. Now I need insert the value in the list ticket, and the field name are same in both list.

how I can get the fieldname and add it at the second list. {{ticket.{{field.value.fieldname}}}} fail.

Thanks. YnievesDotNet


#2
{{ticket[field.value.fieldname]}} 

???


#3

btw, this way you are not mixing two lists. You are adressing a property of object ticket using the value of field.value.fieldname.

And double interpolation {{ {{ }} }} is not supposed to work in any circumstance (not proper angular template syntax)

https://angular.io/guide/template-syntax


#4

Print now in console

console.log: [object Object]

??

Thanks.