我将 Calendly 小部件嵌入到一个简单的 Angular 应用程序中。它适用于 Chrome、Firefox 和 Edge,但在 IE 中仅显示一个空白框。
该网站的工作网址是https://cei-demo.firebaseapp.com/schedule-an-appointment
我尝试使用 innerHTML 从组件而不是模板中呈现 HTML 代码。我有同样的问题。
calendly.component.html
<div class="my-5 p-3 container bg-white text-dark">
<div class="calendly-inline-widget" data-url="https://calendly.com/test-cei" style="min-width:320px;height:700px;"></div>
</div>
index.html(在 body 标签的正上方)
<script type="text/javascript" src="https://assets.calendly.com/assets/external/widget.js"></script>
我希望小部件显示在所有浏览器中。
以下是响应 Dmitry Pashkevich 的代码:
组件.ts
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-calendly',
templateUrl: './calendly.component.html',
styleUrls: ['./calendly.component.css']
})
export class CalendlyComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
组件.html
<div class="my-5 p-3 container bg-white text-dark">
<div class="calendly-inline-widget" style="min-width:320px;height:580px;" data-auto-load="false">
</div>
索引.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Carbon Emery Insurance</title>
<base href="/">
<!-- reCaptcha -->
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<!-- Custom Fonts -->
<link href="https://fonts.googleapis.com/css?family=Lato|Montserrat" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="./assets/favicon.ico">
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
</head>
<body>
<app-root></app-root>
<!-- Bootstrap js -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://assets.calendly.com/assets/external/widget.js"></script>
<script>
Calendly.initInlineWidget({
url: 'https://calendly.com/test-cei',
parentElement: document.querySelector('.calendly-inline-widget'),
});
</script>
</body>
</html>