here is angular code
testing.component.ts
import { Component, NgZone, OnInit } from '@angular/core';
import {data} from '../../assets/data.js';
import { IPost } from '../_models/IPost.js';
import {WindowRefService} from '../WindowRef.service';
@Component({
selector: 'app-testing',
templateUrl: './testing.component.html',
styleUrls: ['./testing.component.css']
})
export class TestingComponent implements OnInit {
constructor() { }
ngOnInit(): void { }
callInIframe() {
console.log('Call In Iframe');
}
}
In routine manner such code does not lunch in any container like iframe, however I want to lunch in iframe. Something like this:
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<!--Angular app load in iframe , below code -->
<iframe src="/" frameborder="0" width="100%" height="900px"></iframe>
<script>
**I want to Call Angular method here**
</script>
</body>
</html>
how can I Call callInIframe() in script tag of index.html. @gzoechi
question from:
https://stackoverflow.com/questions/65858808/how-to-run-a-components-method-in-angular-from-iframe-as-its-container 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…