I am trying to render custom option in my custom page. I found an example for magento 1 here but it dint work out as in magento 2 addOptionRenderer is removed I guess.
I tried this to call in from ajax which will return html
$layout = $this->layoutFactory->create();
$block_header = $layout->createBlock('Magento\Catalog\Block\Product\View\Options')
->setTemplate('Magento_Catalog::product/view/options.phtml');
$block_links1 = $layout->createBlock('Magento\Catalog\Block\Product\View\Options\Type\DefaultType','default')->setTemplate('Magento_Catalog::product/view/options/type/default.phtml');
$block_header->setChild('default',$block_links1);
$block_links2 = $layout->createBlock('Magento\Catalog\Block\Product\View\Options\Type\Text','text')->setTemplate('Magento_Catalog::product/view/options/type/text.phtml');
$block_header->setChild('text',$block_links2);
$block_links3 = $layout->createBlock('Magento\Catalog\Block\Product\View\Options\Type\File','file')->setTemplate('Magento_Catalog::product/view/options/type/file.phtml');
$block_header->setChild('file',$block_links3);
$block_links4 = $layout->createBlock('Magento\Catalog\Block\Product\View\Options\Type\Select','select')->setTemplate('Magento_Catalog::product/view/options/type/select.phtml');
$block_header->setChild('select',$block_links4);
$block_links5 = $layout->createBlock('Magento\Catalog\Block\Product\View\Options\Type\Date','date')->setTemplate('Magento_Catalog::product/view/options/type/date.phtml');
$block_header->setChild('date',$block_links5);
echo $block_header->toHtml();
The error I am getting is
Fatal error: Uncaught Error: Call to a member function renderAmount() on boolean in /my/magento/path/vendor/magento/module-catalog/Block/Product/View/Options/AbstractOptions.php on line 143