Create dynamic web pages using Angular's capability to render HTML, CSS, and

I've encountered an issue while trying to integrate a code snippet received from a post API response into an Angular HTML file. The code works perfectly fine when pasted in the HTML section of Codepen, as shown in the screenshot here. However, when attempting to incorporate it into an Angular project, only a blank page with a loading spinner is displayed. Has anyone faced a similar challenge and found a way to successfully integrate this code into an Angular environment? Any suggestions or hints would be greatly appreciated! I've already tried rendering the entire code as a string using innerHtml, but that didn't resolve the issue either.

<!doctype html>
<html>

<head>
    <title>Payment Page · Razorpay</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta charset="utf-8">
    <script>
        var meta = {};
      var options = {"name":"XYZ Education","order_id":"order_GZjwHCFWRWeIOx","amount":"500000","currency":"INR","callback_url":"https:\/\/razorpay.com\/docs\/payment-gateway\/web-integration\/hosted\/checkout-options\/"};
      var urls = {};
      options.key = "";
    </script>
</head>

<body>
    <style>
        @keyframes lo {
            to {
                transform: rotate(360deg)
            }
        }

        @-webkit-keyframes lo {
            to {
                -webkit-transform: rotate(360deg)
            }
        }

        .loader {
            height: 24px;
            width: 24px;
            border-radius: 50%;
            display: inline-block;
            animation: lo .8s infinite linear;
            -webkit-animation: lo .8s infinite linear;
            transition: 0.3s;
            -webkit-transition: 0.3s;
            opacity: 0;
            border: 2px solid #3395FF;
            border-top-color: transparent
        }

        .vis {
            opacity: 1
        }
    </style>
    <div class="loader vis" style="position:absolute;top:115px;left:50%;margin-left:-12px"></div>
<script src="https://cdn.razorpay.com/static/hosted/embedded-entry.js"></script>

Page Screenshot

Answer №1

If you want to assign this as innerHTML for a specific HTML element, Angular provides the following syntax. In this case, yourhtml is a variable that holds your HTML content as a string:

<div class="blog-post" [innerHtml]="yourhtml"></div>

This solution was influenced by the response of Cobus Kruger, which can be found here where he elaborates on the topic

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

CSS Flexbox: Achieving Perfect Alignment for a Responsive Hamburger Navbar

This is a specific inquiry that requires your attention To begin, kindly execute the code in fullscreen mode Inspect the code and adjust it to fit within a mobile width (there seems to be an issue with responsiveness) Next, open the hamburger menu As show ...

Exploring the dynamic world of Angular2 animations paired with the

In my layout, I have a row with three columns and two buttons to toggle the visibility of the side panels: col-md-3 col-md-7 col-md-2 ------------------------------------ | | | | | left | middle panel | | ...

send information from a service's observable method to an unrelated component

service.ts @Injectable({ providedIn:'root' }) export class textAppService{ constructor(private http: HttpClient){} getPersonDetail(id:any):Observable<any>{ return id? this.http.post(ur;, {id:id}):of(new personDetails()); } } ...

Is there a way to connect CSS files from a different directory?

I'm currently in the process of developing a website and I encountered an issue with linking my CSS file, which is stored in a different folder. I originally had it in the same directory as my HTML code, but now I need to figure out how to link it pro ...

A Foolproof Method to Dynamically Toggle HTML Checkbox in ASP.NET Using JavaScript

Although there have been numerous inquiries related to this subject, I haven't been able to find a solution specific to my situation. I currently have a gridview that contains checkboxes. What I'm trying to achieve is that when I select the chec ...

Showing the output of an HTTP request in hapi.js version 17.2.0

I am attempting to showcase a page utilizing the latest version of HapiJS 17, which has a dependency on HTTP requests. Essentially, I am consuming a REST API and then returning it using the new response toolkit known as 'h toolkit,' but an error ...

Changing the format of a numerical value to include commas for every 1000 increment

I'm trying to find a way to format numbers in a specific manner, such as changing 1234567 into 1,234,567. However, I've run into some issues when attempting to use the currency pipe of TypeScript. It adds USD or $ in front of the number, which i ...

Remove the pop-up using its unique identifier, element, or style class

I recently launched a free hosting site, but I'm encountering an issue where an ad for the site keeps appearing upon loading. I need to find a way to remove the specific rows that contain this ad. Specifically, I want to delete the ****BOLD**** rows, ...

Why are only some of my images appearing on the screen?

I am trying to showcase four images - two in the first row and two below it. However, I am facing an issue where only the images in the top row are appearing while the ones in the second row seem to be missing. I'm not sure what is causing this probl ...

Leveraging lodash for a double groupBy operation

Hey everyone, I'm working on categorizing an array of objects by a specific attribute. Initially, using groupBy worked perfectly fine. However, now I need to go a step further and group these categories based on another attribute. I'm facing some ...

Identifying specific text enclosed within tags in an external file using PHP

I recently started learning about php, and I am looking for a script that can identify text between specific tags in an external file. I came across a solution here that extracts the text within tags from a given string. However, I am unsure how to mo ...

When using React.js, clicking on an answer option will change the color of all options, not just the one that was clicked

I'm currently working on my quiz page where all answer options change color when clicked. However, I only want the selected answer option to be colored based on its correctness. The data is being retrieved from a data.json array. export default functi ...

Scroll upwards within a nested div

Is there a way to smoothly animate the content of the inner div upward without requiring any button clicks? Also, is there a method to trigger an event once the animation has completed? ...

The function db.query in Node.js isn't working as expected

Currently working with Node.js and Express, I am seeking to run queries on a MySQL database hosted on AWS EC2. In my db_connection.js file, I have established a connection to the database and attempted to export the connection (db) for use in other JavaSc ...

Concentrate on implementing Cross-domain Ajax functionality in Opera browser

For a unique and interesting browsing experience, try using Opera 9.62 to explore the nuances of cross-sub-domain JavaScript calls with Ajax. To understand this better, follow these instructions by placing three simple files on appropriate domains. foo.ht ...

Utilizing Props in Vue.js to Access Data for v-model

After browsing online, I attempted to pass props to data in the following manner: Child Component: props: { idInput: { type: String, required: false }, nameInput: { type: String, required: false }, }, data() { return { id: this.idInput, na ...

how to transfer data from backend servlet to frontend javascript

Hey, I'm still learning about servlets so please excuse any confusion in my message! So basically, I'm trying to figure out how to pass a value from a servlet to JavaScript or even retrieve values from a servlet method within JavaScript. But I&ap ...

What is the best way to access data stored in the state of the store.js within a Vue application?

Currently, I am working on my initial project using Vue.js. The application involves a multi-step form that shares a common header and footer. As the user progresses through each step, the data entered is sent to store.js for storage. However, I have encou ...

The Node express GET route experiences intermittent failures when using wildcard match for every other request

I have configured my router to accept any GET request that does not include the word "API" in it. This is specifically for my single page application to handle bookmarked URLs that are not recognized by the app's routes. However, I am encountering an ...

Generating Bootstrap Vue Dropdown components in real time

I am currently utilizing Bootstrap Vue to construct a dynamic Dropdown component that can render different elements such as item, title, and divider. Is there a method to accomplish this task effectively? The desired outcome for the Dropdown component wou ...