1
我有一個角度實時消息應用程序,我想使用HTML5通知。我想我的控制器內的以下內容: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'
});
}
的通知不顯示。我在這裏做錯了什麼?
你[授予權限](https://developer.mozilla.org/en-US/docs/Web/API/notification)? –