angularjs - Angular - Displaying an object using a dynamic variable? -


i have following code:

{{ currentproductdetails.metadata.spec_category_0_spec_image }} 

but need 0 reference variable. this:

{{ currentproductdetails.metadata.spec_category_{{ configview }}_spec_image }} 

but doesn't work. there way can accomplish this?

thanks.

you need use bracket notation here:

{{ currentproductdetails.metadata['spec_category_' + configview + '_spec_image'] }} 

think of currentproductdetails.metadata object, , 'spec_category_' + configview + '_spec_image' construct dynamic property key of it.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -