You can pass data from the Controller action to the Template files in Magento via Block Class.
You can’t directly pass controller data to view the template files but using the Block class you can achieve it successfully.
By use of the Magento interface, Magento\Framework\App\Request\DataPersistorInterface We are able to store data by key with the set(), get() method. Continue reading “How to pass data from Controller to View Template files in Magento 2?”