ember.js

How to make emberjs app with a mobile look (like the one in jquery mobile)?

ぐ巨炮叔叔 提交于 2019-12-21 15:45:29
问题 I have a simple project of a web application for mobile using Emberjs. For the look and feel, I want something equivalent to JQuery Mobile. Is there a way to mix Emberjs and jquery mobile? If so, how? I have looked at the Travis-ci mobile app and they seem to have only defined a specific css for the mobile version. What is strange is that they also have this file : file that seems to be an attempt to integrate with JQMobile but they don't use it anywhere in the code. I also have found this

How can i set the ApplicationController in Ember.Router

可紊 提交于 2019-12-21 14:36:31
问题 I there any other possibility to handle with Ember.Router controllers and views? My app structure generally depends on require.js which takes care of the corresponding dependencies. In my example i'm doing the App.ApplicationController thing as the main router controller. Here's a jsfiddle: http://jsfiddle.net/mediastuttgart/uMKGt/1/ But is there any chance to set this manually? I've found this commit message https://github.com/emberjs/ember.js/commit/be69395f5eec4187b1df052d7386bcda45f79475

Appending Ember Component to a DOM element not managed by Ember

大兔子大兔子 提交于 2019-12-21 12:58:21
问题 I would like to append an Ember Component ComponentB to a DOM element which is generated by some non-Ember UI library on didInsertElement of ComponentA , resulting in something like <div class='ember-view component-a'> <div class='i-know-nothing-of-ember'> <div class='ember-view component-b'></div> </div> </div> I am aware of appendTo(element) method, however it fails with assertion You cannot append to an existing Ember.View. Consider using Ember.ContainerView instead. I also tried calling

Emberjs bindAttr inside of #each

点点圈 提交于 2019-12-21 12:35:36
问题 Code for view is Ember.View.extend({ template: Ember.Handlebars.compile(html), // html is in string content: function() { return [ { Title: "Dashboard", ID: "dashboard" }, { Title: "Invoices", ID: "invoices" }, { Title: "Expenses", ID: "expenses" }, { Title: "People", ID: "people" }, { Title: "Reports", ID: "reports" }, { Title: "Settings", ID: "settings" } ]}, iconClass: function(link){ return "icon icon-" + link.ID } }); Template (show above as "html") looks like this: <ul> {{#each link in

Fixing Initializers deprecation in Ember 1.12.0

时光毁灭记忆、已成空白 提交于 2019-12-21 12:30:22
问题 I am refering to this particular deprecation that was introduced in Ember 1.12 lookup was called on a Registry. The initializer API no longer receives a container, and you should use an instanceInitializer to look up objects from the container I looked at the guide, but I am unsure on how to fix this. Here's a snippet of the code I have at the moment initialize = (container, app) -> auth = container.lookup('auth-manager:main') local_config = ($.ajax type: 'GET' url: '/config.json' async:false

Ember Data: Get a Model in the Console

耗尽温柔 提交于 2019-12-21 12:11:51
问题 I have the simplest possible Ember app in this JSBin. All I'm trying to do is find a model. Based on other SO questions, I've tried the following. App.User.get('store').find('user', 1); App.User.Store.find('user', 1); I've defined App.Store , but App.Store returns undefined in the console. I'm obviously missing the absolute most basic concepts of Ember models. Explain like I'm 5, please? I literally just want to return a user object and call a property on it. 回答1: The store is injected to

Where is fixture data in ember.js with cli

房东的猫 提交于 2019-12-21 12:10:43
问题 I'm trying to use fixture data in an ember app generated with cli. I can't find my data. The inspector shows I have a model called post but nothing in it. I'm not sure why it's not working so posting the files that I think are relevant... models/post.js var Post = DS.Model.extend({ title: DS.attr('string'), content: DS.attr('string'), publishDate: DS.attr('date') }); Post.reopenClass({ FIXTURES: [ { id: 1, title: "Writing a blog in Ember", content: "I am writting a blog", publishDate: "05/22

Bindings Computed Property in Ember TextField

我的梦境 提交于 2019-12-21 12:07:20
问题 I'm trying to bind my data model to the text field in Ember.js. The model has a field that represents a currency value (e.g., $1,000.50). The user can then change this value. Ember receives the data as a Number (1000.50) -not currency formatted. I bind the view to a computed property that has the nice format. Here is my Handlebars template. {{input classNames="amount" valueBinding="p.amountFmt"}}</td> My model looks like: App.Product = Ember.Object.extend({ amount : 0.00, amountFmt: function

Define the ember data model for nested rest url

走远了吗. 提交于 2019-12-21 11:35:22
问题 I am trying to do something that sounds simple but I can't find the solution. My application needs to edit documents which contains pages. Here is my model : MyApplication.Document = DS.Model.extend({ title: DS.attr('string'), pages: DS.hasMany('page', {async: true}) }); MyApplication.Page = DS.Model.extend({ document: DS.belongsTo('document', {async: true}), title: DS.attr('string'), params: DS.attr(), objects: DS.attr() }); And the routes : MyApplication.Router.map(function () { this

Can't get ember bindings to work as documented

谁说我不能喝 提交于 2019-12-21 11:01:07
问题 I am following the documentation on emberjs.com, but can't get the first bindings example to work. I created a jsfiddle to demonstrate. What am I missing? 回答1: Ember.js uses the concept of a RunLoop to allow bindings, observers and so on. The problem with the example is that by setting a (bound) property and immediately getting the value via console.log no event is fired which would trigger the RunLoop and therefore synchronize the changes. There are 2 excellent blog posts about the RunLoop: