ember.js

Ember CLI Hook/Event Error

妖精的绣舞 提交于 2019-12-23 03:59:09
问题 I'm using Ember CLI 1.13 and I'm attempting to create a router mixin in an addon that binds to the willTransition hook, but the issue I'm encountering is not limited to this event. At this point the mixin looks like such: import Ember from 'ember'; export default Ember.Mixin.create({ genericFunction: function(transition) { console.log('--- generic function ---'); }.on('willTransition') }); When attempting to run the dummy app utilising the mixin, I get the following error: Uncaught TypeError:

accessing another models data in ember.js

China☆狼群 提交于 2019-12-23 03:33:17
问题 I have a little asset tracking system that I am trying to build. I have many assets, and I have many tags. Assets have many tags and viceaversa I would like to be able to select a tag from a list, and display only the assets that belong to the selected tag. I am having a hard time trying to figure out how to get the select view to show the list of tags. I have a feeling that it has to do with my routes... I am trying to use this.controllerFor('tags').set('content', this.store.find('tag') to

How to set the i18n.locale from within an initializer

半世苍凉 提交于 2019-12-23 02:51:03
问题 I would like to set 'i18n.locale' from within an initializer in EmberJS. I am using 1.12 via Ember-CLI with ember-i18n. I tried this import Ember from 'ember'; export function initialize(container, application) { Ember.set('i18n.locale', 'de'); } export default { name: 'user-locale', initialize: initialize } but am receiving Assertion Failed: Path 'i18n.locale' must be global if no obj is given. 回答1: You could get i18n as service:i18n and use instance-initializer to set i18n.locale . //app

Ember-cli moving files to an external folder

≡放荡痞女 提交于 2019-12-23 02:41:30
问题 So I have an ember CLI app that's in something like 'c:/foo/bar/ember' and want to have the final generated files copy to 'c:/foo/emberApp'. When I do the broccoli build i get all the built files into c:/foo/bar/ember/dist. I'd like to pick some of these files and move them to c:/foo/emberApp. What's the best way to go about this? I've seen people use grunt but this would mean I lose the broccoli speed increase. My brocfile is just the basic ember-cli one, no modifications. I'll include below

EmberJS - RequireJS - How to connect a view/template to an outlet of a child view

笑着哭i 提交于 2019-12-23 02:38:55
问题 Again a question due to EmberJS evolving quite fast :) [EDIT] I am using EmberJS from github. This is the version I am using https://github.com/emberjs/ember.js/tree/c87ad9fc13f7883e7b898c9fb9b1630cb2fc9bf1 [/EDIT] This question is a follow up of EmberJS - Manually bind controller to view But you don't need to read it to understand the following question. I have an EmberJS application and I am using requireJS to load my controllers and views for the section of the application the router is

EmberJs, changedAttributes() is not showing changes in the nested keys of a Hash attribute

ε祈祈猫儿з 提交于 2019-12-23 02:38:54
问题 The object is DS.Model: $E.toString() > "<reports-dashboard-client-app@model:report::ember596:914fc1b0-b14d-0133-bce2-68a86d03d830>" The attribute is a Hash: // app/models/report.js export default DS.Model.extend({ filters: DS.attr(), ... }); This is how it looks like now: $E.get('filters') > Object {__ember_meta__: Meta} > __ember_meta__: Meta > age_groups: (...) > get age_groups: GETTER_FUNCTION() > set age_groups: SETTER_FUNCTION(value) > genders: (...) > get genders: GETTER_FUNCTION() >

{{action}} with a click event doesn't trigger the function in the v2 Ember router

最后都变了- 提交于 2019-12-23 02:36:34
问题 I just updated Ember and I am trying to convert an old app to the new router API. In my template I have this: <button {{ action "createNewApp" }} class="btn btn-primary">Create application</button> And I put a createNewApp in my route: App.CreateAppRoute = Ember.Route.extend({ renderTemplates: function() { this.render({ outlet: 'content'}); }, createNewApp: function(){ console.log("It's clicked"); } }); However, when I click on the button the function is never called. I have tried to change

ember data no model was found for attribute name

一笑奈何 提交于 2019-12-23 02:36:21
问题 I have defined a model(app/models/job.js) import DS from 'ember-data'; export default DS.Model.extend({ status: DS.attr(), result: DS.attr() }); And I am trying to load it from the index controller(app/controllers/index.js) import Ember from 'ember'; export default Ember.Controller.extend({ productName: "", customerName: "", startDate: "", endDate: "", actions: { search: function() { let data = this.store.find("job", '9e5ce869-89b3-4bfc-a70f-034593c21eae'); return data; } } }); The HTTP

GET unconventional JSON with Ember-data

梦想的初衷 提交于 2019-12-23 02:29:24
问题 I am working with Ember 1.5.1 and Ember-data 1.0 beta and I am using the DS.RESTADAPTER CLASS. I have two models, let say Post and User . The server replies at a GET request with the following JSON { data: [ .... ] } data is an array of users or posts depending on the request. The RestAdapter is designed around the idea that the JSON exchanged with the server should be conventional, and it expects the JSON returned from your server should look like this { posts: [ .... ] } or { users: [ ....

Ember.js app, Parse throws 404 for any path but root

蓝咒 提交于 2019-12-23 02:27:04
问题 I have an ember app that is served by Parse hosting, and for the most part it's working great if the user starts at the root URL (for which Parse serves up the public/index.html file). However, if a user loads the page at any path, say, /about, Parse will look for a public/about.html file, which doesn't exist (ember serves everything from the index.html file). Parse throws a 404 for any path but the root. How do I get around this? I have a mini Express app setup, perhaps I could catch all