ember

EmberJS - Manually bind controller to view

匿名 (未验证) 提交于 2019-12-03 01:00:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Lately EmberJS changed a lot (Router, ...) and the code I have started to write less than a month ago is now broken. One of the issue I have right now is I am not able to manually bind the controller to the view. I am using requireJS by the way... So I used to the able to do something like this (here to define the view for my menu and the menu items), to actually get the Controller content and selected properties. define ( 'app/common/views/menu', [ 'text!app/common/templates/menu.hbs', 'ember' ], /** * Menu view * * @param template *

How to use one-way binding on emberjs?

匿名 (未验证) 提交于 2019-12-03 00:52:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm starting to play around with ember but one thing I haven't been able to wrap my head around is how to use one-way bindings, consider the following code: HTML <script type="text/x-handlebars"> <h1>Some App</h1> <p> My Name is: {{name}} </p> <form {{action 'updateName' on="submit"}}> {{view Ember.TextField valueBinding="name"}} <input type="submit" value="Save"> </form> </script> JS var App = Ember.Application.create(); App.ApplicationRoute = Ember.Route.extend({ model: function() { return { name: 'John Doe' } }, events: { updateName:

Ember cleanup on leaving route

匿名 (未验证) 提交于 2019-12-03 00:50:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to make some cleanup when i leave route, like stopping timers. For that i need an event that triggers when leaving the route, and i need access to instance of controller inside of that event. There is an exit event, but it doesn't get any arguments, and this.get('controller') inside it doesn't work too - returns undefined . Is there a proper way for obtaining controller instance in the exit event, or, maybe, another event that i don't know of? I setup this fiddle with an example of what i want.. 回答1: You can achieve this by calling

Ember JS and Multiple single page apps

匿名 (未验证) 提交于 2019-12-03 00:46:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Say I have a web app - a large, complex, rails app, like an accounting application. I see a use for several single page apps instead of the typical rails round tripping pages. For example, I can see a user better served with an intuitive single page/dynamic app for: Creating Bank Reconciliation Creating an Invoice Filling out a Time Report etc.. These are all distinct one page apps... All the ember apps I see are single page and single purpose. I want to have many single page apps, built with ember. How would that look with respect to: