This service can be injected in the following way:
import Route from '@ember/routing/route';
import {inject as service} from '@ember/service';
export default Route.extend({
notifications: service(), // notifications will be available as a property
// ... your other code
});
Then described below are the various methods that you are able to call from the Notifications Service once it is injected.
Methods
Properties
closeAllNotifications
(
-
outlet
Close all notifications for a particular outlet.
Parameters:
-
outlet
Stringoutlet to close notifications in
closeNotification
(
-
message
Close a notification given by a particular object.
Parameters:
-
message
Objectnotification object
handleNotification
(
private
-
message
Internal method that handles a raw notification. This is used by all of the show____ methods, so most of the time it is best just to use the proper function to build the notification for you.
Parameters:
-
message
Objectoptions for the notification
showError
(
-
message
-
outlet
-
dismissable
Shows an error message, ie it shows a message to the selected outlet with the "error" styling.
showInfo
(
-
message
-
outlet
-
dismissable
Shows an informational message, ie it shows a message to the selected outlet with the "info" styling.