The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [viewmodel]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
4
votes
2answers
920 views

When it is good to use viewModel ? What is difference between viewModel and Block?

I am bit confuse about using viewModel in Magento. I am not getting exact difference between viewModel and Block. In which case using viewModel is best case? Any help will be appreciated.
6
votes
2answers
3k views

Magento 2: How to Add a viewModel to a core block?

I am trying to overwrite a core template and add my custom logic using a viewModel as follow: <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...