我想分享一些动态内容到WhatsApp,动态内容从API获取。因此,我在 component.ts 文件中使用 Angular Meta 类来使用动态内容更新 index.html 中的默认元标记属性。
当我将 URL 导航到我想要更新 og 元标记的特定页面时。元标记已添加到 DOM 中。但是当我与 WhatsApp 共享相同的页面 URL 时。动态内容不出现。
索引.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>DMK Youth Wing</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- og meta tags for link share -->
<meta property="og:title" content="" />
<meta property="og:description" content="" />
<meta property="og:url" content="https://www.youthwingdmk.in/" />
<meta property="og:image" content="https://www.myhealthunlimited.com/wp-content/uploads/2016/07/300x200.png" />
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css"
integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous" />
<link rel="icon" type="image/x-icon" href="./assets/images/Youth wing logo2.png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link …Run Code Online (Sandbox Code Playgroud) 我盯着 vs 代码编辑器上的 java 脚本编码,当我试图将外部模块包含到我的项目中时,代码编辑器建议这个 -->(文件是一个 CommonJS 模块;它可能被转换为一个 ES6 模块。)。有什么办法可以用推荐行解决这个问题吗?我的代码