I am integrating razorpay payment checkout form into my MEAN stack application which uses Angular 2+.
Reference: https://docs.razorpay.com/docs/checkout-form
As per their documentation, i need to add the below script tag into the html page.
When i added the below script in angular 2's index.html page, all works, but naturally it is displaying in all the pages.
<script
src="https://checkout.razorpay.com/v1/checkout.js"
data-key="rzp_test_1dfsgdhsreQvD"
data-amount="5000"
data-buttontext="Pay with Razorpay"
data-name="Compy name"
data-description="Test Transaction with Razor Pay"
data-image="./assets/static/hmicon.png"
data-prefill.name="Test"
data-prefill.email="test@gmail.com"
data-theme.color="#F37254">
</script>
<input type="hidden" value="Hidden Element" name="hidden">
How to add the above script in a specific components template html file?
In my html template as of now i just have
<div class="container fixContainer">
...
... <!--There is no html or body tag used here-->
<div *ngIf="showButton" class="col-md-8 col-sm-8 col-xs-8">
<!--I tried to include the above script here, but nothing shows up-->
...
...
</div>
</div>
Or if not in html, how to include in my component ts file?