javascript - Ember.js: Using an ArrayController without a route? -


I have a list of categories that I would like to display on the page. I have been looking for hours to walk properly, but I find conflicting information and methods that are either not working or dislike with the current version of Amber.

The app and amber-data item to create:

  var app = amber Apps .create (); App.ApplicationAdapter = DS.FixtureAdapter; App.Store = DS.Store.extend ({adapter: 'DS.FixtureAdapter'});   

I am using amber-data with data for some categories:

  App.Category.FIXTURES = [{id: 1, name: category 1 ', details:' first class'}, {id: 2, name: 'category2', description: 'second category'}];   

Then I made a model to present an example of a category ("version" relates to a different model, where examples of the category are examples of the examples):

  App.Category = DS.Model.extend ({versions: DS.hasMany ('version'), name: DS.attr ('string'), Description: DS.attr ('string') });   

Then I have created an arranger controller, but I am having trouble finding the content.

  app.cotagescancrrr = amber ArrayController.Sent ({content:), Init: function () {this.set ('content', ???);}});   

It is not put on a path because it is not permissible, so I can not use the "model" property in any way.

Replace the ArrayController in ??? , I've tried many things:

I tried this.store.find ('category') as for example routes show, but I get an "Uncaught TypeError" error: The property 'can not read' of 'tap' can not be read.

I tried App.Store.find ('category') and he gave me an "Uncort Type Error" error: there is no undefined function.

Any help or push in the right direction is appreciated. I think I'm not going in the right direction too.

some things First of all, remember that if the controllers are single songs then your init function will only set a fire for the entire life cycle of your application (which is probably not what you want ). But it does not really matter, because ...

The way you handle the model is not the method that is set up for Ember.js. You should not be brought in the model in the controllers, the only way there is no store property on the controller. You need to apply a model hook on your route, such as:

  app. Path of categories = Amber way. Extension ({model: function} .store.find ('category');}}); From there, Amber will automatically set  model  property ( not  to  content  property)  model  

So, just end the content property and end the . Init the function with your controller, and apply that hook to your model, and it would be nice to go.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -