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
20
votes
1 answer

Using DS.model or Ember.model or Ember.Object when defining a model?

This screencast : http://www.embercasts.com/episodes/getting-started-with-ember-model used Ember.model to create a person model like this: App.Person = Ember.Model.extend({ name : Ember.attr() }) The docs give this example using…
Jatin
  • 14,112
  • 16
  • 49
  • 78
11
votes
1 answer

Ember-table integration with Ember-model / Ember-data

I am trying to link ember-models to the ember-table to pull paginated records from the server and add them to the table when scrolling down. I can get it working by just requesting my api url with page number like in the ajax example on…
Rick Moss
  • 926
  • 1
  • 17
  • 34
10
votes
3 answers

Ember deeply nested routes do not keep parent dynamic parameter

I've got this ember application: Ember : 1.3.2 Ember Model : 0.0.11 Handlebars : 1.3.0 jQuery : 1.9.1 Using this resource map: App.Router.map(function () { this.resource('dimensions', function() { this.resource('dimension', {…
vsiguero
  • 103
  • 1
  • 6
10
votes
1 answer

Difference between model.save() versus model.get('store').commit()

What is the difference between // 'this' is the controller this.get('model').save(); and // 'this' is the controller this.get('model').get('store').commit(); ? Of the little testing I did, they both gave me the same results. Which one should I…
HaoQi Li
  • 11,970
  • 14
  • 58
  • 77
8
votes
1 answer

How to access Ember Model from the Route in Ember CLI

Perhaps doing this with regular Ember application having all the code sitting in app.js would have been much easier for me. But since I'm using Ember CLI I'm having trouble accessing my model in my Route. I'm still trying to learn how to use Ember…
Vinay
  • 318
  • 2
  • 4
  • 17
7
votes
1 answer

How to delete all records associated with an ember model without clearing local Storage?

I have extended the program given in this stackoverflow answer to have a program that deletes all the records all at once. However, the deletion happens only in batches and does not delete everything all at once. Here is a snippet of the function I…
user2431285
  • 661
  • 11
  • 19
5
votes
2 answers

How to define an enumeration with ember-model

In my ember-model model I need to set a String attribute from an enumeration. Is it possible with ember-model? By Example I would like to have a Book model: App.Book({ id: Ember.attr(), title: Ember.attr( 'String' ), author: Ember.attr(…
fvisticot
  • 7,936
  • 14
  • 49
  • 79
5
votes
1 answer

Proper way to sideload data with ember-model

Im trying to understand the proper way to sideload data using ember-model I have json coming back like so ( i slimmed it down a bit from the actual json for sake of space here ) { "classrooms" : [ { "classroom_name" : "Class 1", …
CoderStash
  • 171
  • 3
  • 15
4
votes
2 answers

Iterate over an ember model query

this.store.findAll('game').then(function(results){ // RUN SOME OPERATION ON THEM }) I would like to know how I can play with the results variable. I understand I can do results.get('firstObject') // returns the first object. I'd like to know…
Prakash Raman
  • 13,319
  • 27
  • 82
  • 132
4
votes
1 answer

How to Add Child Record to Existing Parent Record?

I've been googling and scouring Stack Overflow for some sort of hint on this subject but the information is scattered at best. I'm trying to Create a new Child Record (Comment) and save it to an existing Parent Record (Post). I am using…
Eric Johnson
  • 111
  • 6
3
votes
1 answer

Create Array of records of a model ember js

I have a model named 'someModel' is as follows import DS from 'ember-data'; export default DS.Model.extend({ type: DS.attr('string'), email: DS.attr('string'), days: DS.attr('number'), isInstant: DS.attr('boolean'), cutHours:…
3
votes
2 answers

Ember query params for nested routes

I have the url /tests/test-slug?extradata=data all my params are setup correctly within ember. When that extradata param is set the model updates with the new data from the (/tests/test-slug?extradata=data) response. Usually I would retrieve data…
Robert
  • 815
  • 13
  • 29
3
votes
1 answer

ember js how to push object to the top of the stack in the ArrayController

I have this controller where to fetch data from the server I have to fire fetchPosts method and to add new post fire add App.PostsController = Ember.ArrayController.extend({ actions: { fetchPosts: function (id) { var data =…
Alex Berdyshev
  • 761
  • 2
  • 7
  • 21
2
votes
1 answer

Ember Data incompatible with Rails JSON response: Encountered a resource with an undefined type

I'm trying to set up Ember Data to talk to a Rails backend. Ember succeeds at calling the endpoint, gets both a 200 and some response data. The problem is that Ember is unable to match the response data to one of my Ember models I've made. My model…
Sticky
  • 3,671
  • 5
  • 34
  • 58
2
votes
1 answer

What is the correct way to `push` a updated model back to store?

I am trying to push the updated model back to store. i tried with couple of ways still getting failed. Please help me to understand to push the model back to store without updating backend api. here is my try: import Ember from 'ember'; …
user2024080
  • 1
  • 14
  • 56
  • 96
1
2 3
8 9