My site is based on angular 2 and I want to show notification to user in the panel. So I used OneSignal for this purpose but there is a problem with it. when I added the OneSignal script the page content wont load and browser shows the blank page and when I remove the script of OneSignal everything is fine.
the load script which cause the problem :
<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async='async'></script>
and the initialization of OneSignal inside component :
ngOnInit(){
var OneSignal = window['OneSignal'] || [];
OneSignal.push(["init", {
appId: "xxx-xxx-xxx",
autoRegister: false,
subdomainName: 'https://something.onesignal.com',
httpPermissionRequest: {
enable: true
},
notifyButton: {
enable: true
}
}]);
}
You need to load
OneSignalSDK
script beforezonejs
otherwise see picture belowhttps://plnkr.co/edit/lpal29dghPPl78yo4yur?p=preview