Angular のリアルタイム メッセージング アプリケーションがあり、HTML5 通知を使用したいと考えていました。コントローラー内で次のことを試しました。
$rootScope.$on("message_recieved", function(event, data) {
new Notification(data.sender_name, {
body: data.body, icon: data.avatar, dir:'auto'
});
}
と
$rootScope.$on("server_offline", function(event, data) {
new Notification("Offline", {
body: "You are offline. Refresh your page now.", dir:'auto'
});
}
通知が表示されません。私はここで何か悪いことをしていますか?