i have a node api(localhost:5000/ ) which returns html type response.
when i run localhost:5000/ in browser it execute the scripts from returned response from my api.below is my app.js file.
const http = require("http");
const server = http.createServer((req, res) => {
const { headers, url, method } = req;
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Content-Type", "text/html");
res.end(`<script>alert('test');</script>`);
});
const PORT = 5000;
server.listen(PORT, () => console.log(`Server running on ${PORT}`));
The same thing i want to achieve via angular . i will call this api and i want the script from my response to get executed. how can i tell angular that my script is safe and can be trusted ? Have tried with innerhtml but doesnt work.
<div class="adv" [innerHtml]="htmlToAdd"></div>