I am trying to integrate LinkedIn login
in angular 2, all are working fine, but I am getting few errors in webpack, below is my code and the errors I am getting:
//linkedin.component.ts
constructor(private zone: NgZone) {
window.angularComponentRef = {
zone: this.zone,
componentFn: () => this.onLinkedInLoad(),
component: this
};
}
ngOnInit() {
// Creating script tag with linkedin src and required api details
var linkedinEle = document.createElement('script');
linkedinEle.type = 'text/javascript';
linkedinEle.src = 'http://platform.linkedin.com/in.js';
linkedinEle.innerHTML = 'api_key: xxxxxxxxxxx \n authorize: true \n onLoad: onLinkedInLoad';
document.head.appendChild(linkedinEle);
}
// this will called when the linkedin api gets load
onLinkedInLoad() {
IN.Event.on(IN, "auth", function() {
console.log('Hell yeah');
});
}
// index.html
function onLinkedInLoad() {
window.angularComponentRef.zone.run(function () { window.angularComponentRef.componentFn()})
}
This all are working fine, but getting this errors in webpack:
1. Property 'angularComponentRef' does not exist on type 'Window'.
2. Cannot find name 'IN'.
So I thought I can resolve it by declaring it like declare let IN: any
but no luck.