ember.js

Leading character stripped off of API call

試著忘記壹切 提交于 2019-12-14 01:04:46
问题 I am attempting to setup a REST model and have a problem that is completely befuddling me: the API call that is generated seems to remove the first letter of the model and therefore is unable to retrieve the data (gets 404 error). I start by setting up the store: App.Store = DS.Store.extend({ revision: 11, adapter: DS.RESTAdapter.reopen({ namespace: 'api/admin' }) }); Then I setup a model (which is referred to as "dbx_tables" on the REST service: App.dbxTable = DS.Model.extend({ name: "string

Emberjs Routing: Page reloads on every link click

孤街醉人 提交于 2019-12-13 23:29:42
问题 I have an Ember js app, with pushstate enabled. Say I am on a page www.xyz.com/start and I have proper link on the page ( www.xyz.com/abc/def ) and I have defined route in ember for /abc/def . But every time I click on the link, the page is reloaded instead of directly being served by the Ember router. What is the correct way to do this? 回答1: You have to use the link-to helper instead of basic a href links. {{#link-to 'abc/def'}}go to def{{/link-to}} Where 'abc/def' is the route name. See :

EmberJS: reject an upcoming transition

∥☆過路亽.° 提交于 2019-12-13 22:31:44
问题 I have an emberjs app, with a form to edit an object. This page contains a "Save" button, which persists the data into the database. If the object is dirty and the user is going to be transitioned to an other path in the app, I need to warn them about that, and cancel the transition if they reject the confirmation. App.ObjectEditRoute = Ember.Route.extend exit: -> if @get('model.isDirty') if confirm('All your changes will be lost') # We just keep rolling the chain of events and do the

format date error in Ember JS: could not find property on object

限于喜欢 提交于 2019-12-13 20:16:58
问题 Uncaught Error: Handlebars error: Could not find property 'format-date' on object (generated post controller). in ember js 回答1: This error is thrown when the handlebars template contains a custom helper that is not registered. Example (look at the console output) http://emberjs.jsbin.com/gosegede/1/edit hbs <script type="text/x-handlebars" data-template-name="index"> {{format-date "test"}} </script> 来源: https://stackoverflow.com/questions/22344373/format-date-error-in-ember-js-could-not-find

return json data from php for emberjs in the right format with $.getJSON

狂风中的少年 提交于 2019-12-13 20:12:42
问题 I looked at this tutorial and tried to create my own php side script to generate json data. However, I failed on creating a multi-level array. In the example, a json result of { "nextId": null, "items": [{ "title": "Docker, the Linux container runtime: now open-source", "url": "http://docker.io", "id": 5445387, "commentCount": 39, "points": 146, "postedAgo": "2 hours ago", "postedBy": "shykes" }, { "title": "What\u0027s Actually Wrong with Yahoo\u0027s Purchase of Summly", "url": "http:/

Ember.js external json for Store

∥☆過路亽.° 提交于 2019-12-13 20:07:19
问题 I have a json file that lives on the on the server that is hosting my Ember.js app. I want to use that json as the "store" for the app (it will only be for reading). I'm not sure the best way to do this. Do I need to use a RESTAdapter to hit the file, or somehow use it as an external FixtureAdapter, or is there some other way to accomplish this? 回答1: Your best bet is to use the fixture adapter as described here. If the file is static, you can just add it to your page as a script tag and be

EmberJS “this” changed in promise (find) callback

自古美人都是妖i 提交于 2019-12-13 19:13:23
问题 When I want to fetch an account from the server in an controller action e.g: account: false, actions: { // When the oAuth popup returns this method will be called fetchUser: function(id) { // Get the account from the server this.store.find('account', id).then(function(account) { this.set('account', account); }, function(error) { console.log('error', error); }); }, } It throws an error because "this" on the line this.set('account', account) is no longer the controller. How can I set "account"

Ember.RSVP.all seems to resolve immediately

你。 提交于 2019-12-13 18:50:17
问题 I'm really hoping that there's something dumb that I'm doing, but I can't seem to find it. I'm trying to use Ember.RSVP.all in the middle of a chain of promises. The example I have is much simpler than my use, but it demonstrates the issue. In the middle of a chain of promises, I have a set of promises that all need to resolve before the chain can continue - exactly what I understand RSVP.all to be for. Unfortunately, when I return the RSVP.all object, the next promise in the chain runs

Ember.js - currentViewBinding and stop re-rendering on every view transition

匆匆过客 提交于 2019-12-13 18:24:53
问题 I have a statemachine and I am using the new currentViewBinding to swap out parts of an overall containerView whenever a new state is entered using currentViewBinding: index: Ember.State.create({ enter: function(manager) { App.get('appController').set('feedView', Ember.View.create({ templateName: 'dashboard_feed', contentBinding: 'App.feedController.content', controller: App.get('App.feedController') })); } }) At this moment in time, the rendering of these view is quite slow. Is there a way I

Does emberfire 1.3.2 implement findQuery method?

孤人 提交于 2019-12-13 18:22:27
问题 When I tried to load articles by simply calling this.store.find('article', { typeId: model.get('typeId') }) , I get: Error while processing route: article Assertion Failed: You tried to load a query but your adapter does not implement `findQuery` Error: Assertion Failed: You tried to load a query but your adapter does not implement `findQuery` at new Error (native) at Error.EmberError (http://localhost:4200/assets/vendor.js:21769:23) at Object.Ember.assert (http://localhost:4200/assets/vendor