How to get product collection in custom template block in Magento 2

- Fire development, Magento 2

Magento 2 Development

To get product collection in custom template block in Magento 2, use the following code. It is a trick, since you should never use object manager directly, but at the same time the only way to avoid creating a new block:

Source (Stackexchange Question)(Alex P)

More tips from the Cookbook