Questions tagged [ember-model]

Ember Model (EM) is a simple and lightweight model library for Ember.

Ember Model (EM) is a simple and lightweight model library for Ember. It intentionally supports a limited feature set. The main goal is to provide primitives on top of $.ajax that are required by Ember.

EM is still very much a work in progress, but it's flexible enough to be used in apps today. It was extracted out of an Ember app. Please see the issues section for a list of bugs and planned features.

Github repository

135 questions
0
votes
1 answer

Ember JS: Service - Get data from Socket.io

Is this an app appropriate way to get data into a Service? This is what I'd like to have happen. import Ember from 'ember'; export default Ember.Service.extend({ model: (function() { var data = []; var socket =…
Rio Weber
  • 2,757
  • 1
  • 20
  • 28
0
votes
0 answers

Set model not consoled by JSON stringify - what is wrong?

I am setting some value to model like : afterModel:function(model,transation){ Ember.set(model, 'processedTrans', 'TechMahindra'); }, when i require the value I used to get : model.get('processedTrans') - works fine. But in case if I…
user2024080
  • 1
  • 14
  • 56
  • 96
0
votes
0 answers

How to save the parent model from children?

I have a parent route. it has the model which is used by all child routes. when i consume the parent model from one of child ( first page ) I am updating the model like this: selectedList : Ember.computed.map('model.selectedTrans',…
3gwebtrain
  • 14,640
  • 25
  • 121
  • 247
0
votes
1 answer

EmberJS: Can I update a model from a service?

I'm trying to use a service, let's say for User Login session. I retrieve the user's info from the service. Now I want to display this info - ideally using a model (user-profile). My question is, in my service - can I set the user-profile model's…
Put Time
  • 71
  • 6
0
votes
1 answer

How to sort the model array before supply to template

Here is my model, how can i sort it before I send to template? route.js import Ember from 'ember'; export default Ember.Route.extend({ model(){ return { "fruits":[ {fruit:"mango",color:"yello"}, …
3gwebtrain
  • 14,640
  • 25
  • 121
  • 247
0
votes
3 answers

How to get `model` property in `route` path?

How can I get the current route model within current routes action method? I am keep getting error. any one help me here? my route: import Ember from 'ember'; export default Ember.Route.extend({ model: function(params) { …
user2024080
  • 1
  • 14
  • 56
  • 96
0
votes
0 answers

How to use ember data "sub-models" when using pods

I have a json like this: { id: 'some-id', username: 'myusername', name: { first: 'first-name', last: 'last-name' } } I'm using pods with the following structure: pods/ user/ model.js serializer.js …
mumia
  • 83
  • 1
  • 10
0
votes
2 answers

EmberJS filter hasMany data, apply to belongsTo relationship

I have this teams model: export default DS.Model.extend({ "name": attr('string'), "players": DS.hasMany('player',{ async: true }) }); along with this player model: export default DS.Model.extend({ "name": attr('string'), …
Matt
  • 1,811
  • 1
  • 19
  • 30
0
votes
1 answer

Ember.js - Controller not picking model data

I have a model which has this field diaryItemLabel: DS.attr('string'), I want to access the data from this field in my controller. Controller.js I want to replace the 'Add' with whatever data I get from diaryItemLabel. I cannot use…
0
votes
2 answers

What is the correct way to access the model from a controller in Ember

I was wondering what the correct way to access the model from the controller? I noticed that in the init of the controller the model is still null #controller.js init(){ console.log(this.model); // IS NULL } But the setupController method has…
Prakash Raman
  • 13,319
  • 27
  • 82
  • 132
0
votes
3 answers

How to access model array by index in Ember

I am unable to access the EmberArray by index in the template. This is part of my route model(){ return RSVP.hash({ games: this.store.findAll('game') }) } And this is part of the template
First game:…
Prakash Raman
  • 13,319
  • 27
  • 82
  • 132
0
votes
2 answers

Ember Models Table - JSON records

Has anyone successfully loaded a JSON file externally via an ajax call in Ember Models Table? I was hoping this example would work, but there is no associated coded with it. Currently it seems it only works, if you grab your data from your ember…
Matt
  • 1,811
  • 1
  • 19
  • 30
0
votes
1 answer

Ember overwritten model property not being serialised

I'm using Ember 2.4.2 app/models/product.js export default DS.Model.extend({ type: attr('string'), color: attr('string') }); app/models/blue-bags.js export default Product.extend({ type: Ember.computed('color', function() { if…
a7omiton
  • 1,597
  • 4
  • 34
  • 61
0
votes
1 answer

Emberjs findRecord then not waiting for resolve

I have a findRecord method with the json api convention that looks like this: this.store.findRecord('book', 2).then((book) =>{ console.log(book.get('name')); }); The console log is always printing undefined, but the name value is actually…
rafaelmorais
  • 1,323
  • 2
  • 24
  • 49
0
votes
1 answer

Ember display model which has relationship in one component

I want to expose my models to one component and show in one table. I want this to be modular in a way that I can use this component to other models. The way I have done the attributes which have certain relationship do not show up. The problem that…
renno
  • 2,659
  • 2
  • 27
  • 58
1 2 3
8 9