In an Angular project I want to create a component that can display any viewmodel. I want to create a dynamic report that shows any viewmodel we give it But I do not know how to do this
How to dynamically get property value from model by string name?
please guide me
CodePudding user response:
You could use the built-in Javascript Method Object.entries
to dynamically retrieve the properties of the ViewModel and render them accordingly.
See: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/entries