我试图将此代码添加到app.component.ts文件的我的有角项目中,但它显示了一个错误
var options = {
facebook: "facebook_id", // Facebook page ID
whatsapp: "+XXXXXXXXX", // WhatsApp number
call_to_action: "Message us", // Call to action
button_color: "#008000", // Color of button
position: "left", // Position may be 'right' or 'left'
order: "facebook,whatsapp", // Order of buttons
};
var proto = document.location.protocol,
host = "whatshelp.io",
url = proto + "//static." + host;
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = url + '/widget-send-button/js/init.js';
s.onload = function() {
WhWidgetSendButton.init(host, proto, options);
};
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
错误:
答案 0 :(得分:0)
在WhWidgetSendButton
中声明app.component.ts
我已在 Stackblitz
上创建了一个演示declare var WhWidgetSendButton;
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
}