O'Reilly logo

Mastering Ember.js by Mitchel Kelonye

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Connecting the user

When the application is loaded at http://localhost:3000, the user is required to specify the handle to use before joining the chat by submitting the desired nick in the /join <desired nick> format. The App.MessageField view delegates this event to the index controller chat action as:

{{view App.MessageField
  required="required"
  placeholder="message"
  action="chat"
  id="message-input"
  value=controller.message}}

App.MessageField = Em.TextField.extend({
  insertNewline: function(){
    this.triggerAction();
  }
});

This is something that we learned in Chapter 6, Views and Event Management, under the Emitting actions from views section. As we shall see later, the rest of the application's visibility is obscured until the user connects successfully ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required