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
8 months agoYuette
8 months agoJohnson
8 months agoPamela
9 months agoShelia
9 months agoDell
9 months agoDaniela
9 months agoEleonora
10 months agoChrista
10 months agoBrigette
10 months agoEva
10 months agoVi
10 months agoDevorah
10 months agoLaquita
10 months agoRashad
10 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