Exercise: Pass data to another template using a ViewModel in Magento
Magento ViewModel exercise passing data to sidebar template on blog post detail page.
Lesson Content
ViewModels can be created once and then used within multiple templates. This is exactly what you'd like to tackle next.
Using what you just learned, reference the Post ViewModel again, but this time from the blog detail page, and then update the related logic in the sidebar.phtml file just as you did in the last lesson. The resulting output should look similar to:

When you have finished, check the Source Code tab for the solution.
Join the discussion!
Comments
Want to comment on this lesson?
Enroll in this course to leave comments.