Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9155155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:32:40+00:00 2026-06-17T12:32:40+00:00

I have a notification view responsible for displaying global messages at the top of

  • 0

I have a notification view responsible for displaying global messages at the top of the page (info, warning, confirmation messages …)

I created a NotificationView for the purpose, defined its content property and provided two handlers to show and hide the view.

APP.NotificationView = Ember.View.extend({
    templateName: 'notification',
    classNames:['nNote'],
    content:null,

    didInsertElement : function(){                
    },

    click: function() {
        var _self = this;
        _self.$().fadeTo(200, 0.00, function(){ //fade
            _self.$().slideUp(200, function() { //slide up                    
                _self.$().remove(); //then remove from the DOM
            });
        });
       _self.destroy();
    },

    show: function() {
        var _self = this;
        _self.$().css('display','block').css('opacity', 0).slideDown('slow').animate(
            { opacity: 1 },
            { queue: false, duration: 'slow' }
        );          
    }
});

Ideally, i should be able to send an event from any controller or route to show the view with the proper content and styling. What would be the best way to architect this

I thought of using a named outlet in my application’s template, however outlets are not quite suited for dynamic views.

<div id="content">
    {{outlet notification}}
    {{outlet}}
</div>

I was also thinking of architecting the notification view to be a response to “The application” or “A Module” state.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:32:40+00:00Added an answer on June 17, 2026 at 12:32 pm

    Because you have animations you want to run when the notifications change, you will want to create a subclass of Ember.View (a “widget”):

    App.NotificationView = Ember.View.extend({
      notificationDidChange: function() {
        if (this.get('notification') !== null) {
          this.$().slideDown();
        }
      }.observes('notification'),
    
      close: function() {
        this.$().slideUp().then(function() {
          self.set('notification', null);
        });
      },
    
      template: Ember.Handlebars.compile(
        "<button {{action 'close' target='view'}}>Close</button>" +
        "{{view.notification}}"
      )
    });
    

    This widget will expect to have a notification property. You can set it from your application template:

    {{view App.NotificationView id="notifications" notificationBinding="notification"}}
    

    This will gets its notification property from the ApplicationController, so we will create a couple of methods on the controller that other controllers can use to send notifications:

    App.ApplicationController = Ember.Controller.extend({
      closeNotification: function() {
        this.set('notification', null);
      },
    
      notify: function(notification) {
        this.set('notification', notification);
      }
    });
    

    Now, let’s say we want to create a notification every time we enter the dashboard route:

    App.DashboardRoute = Ember.Route.extend({
      setupController: function() {
        var notification = "You have entered the dashboard";
        this.controllerFor('application').notify(notification);
      }
    });
    

    The view itself manages the DOM, while the application controller manages the notification property. You can see it all working at this JSBin.

    Note that if all you wanted to do was display a notification, and didn’t care about animations, you could just have done:

    {{#if notification}}
      <div id="notification">
        <button {{action "closeNotification"}}>Close</button>
        <p id="notification">{{notification}}</p>
      </div>
    {{/if}}
    

    in your application template, with the same ApplicationController, and everything would just work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented a notification bar at the top of my web page. When
I have created a notification system which push notification everyday at 12:02 AM but
I have created a notification and added a PendingIntent so that the notification is
I have my local notification working, but when I click View to come back
I have a case where the child view sends notification to its parent view.
I have created a locale notification for my application which fires every day ,
I have a notification system on my website where users will be notified of
In my app I have a notification in the task bar and when clicked
I'd like to have a notification that informs me when my hard disk space
I have used push notification for my project & was working fine with HTTP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.