My website is built with angular 6, In the site, I got a button and a facebook messenger chat. I want when I click the button, the facebook chat will open and focus cursor
我的网站是用6角搭建的,在网站上,我得到了一个按钮和一个Facebook聊天信使。我希望当我点击按钮时,Facebook聊天将打开并聚焦光标
Some thing like this. Is it possible?
诸如此类的事情。有可能吗?
This is my code, in app.module.ts
这是我的代码,在app.mode.ts中
import { FacebookModule } from ‘ngx-facebook’;
imports: [
// other imports
FacebookModule.forRoot()
],
In document head I got this
在文件头里,我看到了这个
<script type=”text/javascript” src=”https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js"></script>
In app.components.ts
在app.Components.ts中
import { FacebookService, InitParams } from ‘ngx-facebook’;
export class AppComponent implements OnInit {
constructor(private facebookService: FacebookService) { }
ngOnInit(): void {
this.initFacebookService();
}
private initFacebookService(): void {
const initParams: InitParams = { xfbml:true, version:‘v3.2’};
this.facebookService.init(initParams);
}
}
and in index.html
和在index.html中
<div class="fb-customerchat" attribution=setup_tool page_id="1234131234" theme_color="#1ea1d9"
>
</div>
更多回答
It is possible, but you should provide some code and describe a more specific issue here. Have you tried anything?
这是可能的,但您应该提供一些代码并在此处描述更具体的问题。你试过什么吗?
优秀答案推荐
Put this anywhere you want, FB is available globally
把它放在你想要的任何地方,FB在全球都可以买到
somethingclick(){
FB.CustomerChat.showDialog()
}
更多回答
It didn't work for me. Is this from the official docs? EDIT: my bad, actually it worked!
这对我来说并不管用。这是官方文件里的吗?编辑:我的错,实际上它起作用了!
我是一名优秀的程序员,十分优秀!