ember.js - modal popup with ember 1.0 rc6 -


how create modal popup latest version of ember.js? every single example i've found uses connectoutlet, deprecated while ago, , fact i'm new ember doesnt help.

i have named outlet in application template, how render modal popup view outlet controller event? or should use route event?

adam hawkins published excellent post on topic, can find here: http://hawkins.io/2013/06/ember-and-bootstrap-modals/

to summarize:

  • include {{outlet modal}} in application.hbs
  • render outlet router using events
  • animation triggered view's didinsertelement hook , on it's close action
  • modal's close action should target view, waits animation complete before sending close event router

from adam's jsfiddle:

app.applicationroute = ember.route.extend({   events: {     open: function() {       this.render('modal', { into: 'application', outlet: 'modal' });     },      close: function() {       this.render('nothing', { into: 'application', outlet: 'modal' });     },      save: function() {       alert('actions work normal!');     }   } });  app.modalview = ember.view.extend({     didinsertelement: function() {     this.$('.modal, .modal-backdrop').addclass('in');   },    layoutname: 'modal_layout',    close: function() {     var view = this;     // use 1 of: transitionend webkittransitionend otransitionend mstransitionend     // events handler fired once in browser     this.$('.modal').one("transitionend", function(ev) {       view.controller.send('close');     });      this.$('.modal, .modal-backdrop').removeclass('in');   } }); 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -