An Adobe Commerce developer is using a view model within an existing block:

What are two ways to access the view model class in the template? (Choose two.)
To access a view model within an existing block, the developer can use either of the following ways:
$block->getData('view_model'): This method will return the view model object that is assigned to the argument name ''view_model'' in the layout XML file. For example:
<referenceBlock name=''blog_posts_list''>
In the template file, the developer can access the view model object by using:
$block->getData('view_model')
$block->getData('viewModel'): This method will return the view model object that is assigned to the argument name ''viewModel'' in the layout XML file. For example:
<referenceBlock name=''blog_posts_list''>
In the template file, the developer can access the view model object by using:
$block->getData('viewModel')
The following methods are not valid and will not work:
$block->viewModel(): This method does not exist and will cause an error.
$block->getViewHodel(): This method is misspelled and will cause an error.
Royal
7 months agoYuette
7 months agoJohnson
7 months agoPamela
7 months agoShelia
7 months agoDell
8 months agoDaniela
8 months agoEleonora
8 months agoChrista
8 months agoBrigette
8 months agoEva
8 months agoVi
8 months agoDevorah
8 months agoLaquita
8 months agoRashad
8 months agoSteffanie
2 years agoOretha
2 years agoLashon
2 years agoReita
2 years agoQuentin
2 years agoMalcom
2 years agoPrecious
2 years agoRebecka
2 years agoArt
2 years agoKallie
2 years agoPete
2 years agoGilma
2 years agoTequila
2 years agoSon
2 years agoElinore
2 years agoDaron
2 years agoDierdre
2 years agoRicki
2 years agoShawnda
2 years agoStefania
2 years agoLino
2 years ago