samedi 28 novembre 2015

Using different prototypes depending on type in Ember

Im playing around with Ember.js atm and Im not really used to the concept so far. What I want to do now is to build a little cms and I need something like a Class or Object depending on the type of content. E.g. I load up an element of the type text, this type has some content. Another Element is of the type Section, this has the attributes size, color and whatever. What I need now is to let the route decide, what kind of content it has loaded, and depending on that build omething new with the special properties. Let's say

Ember Route loads content, looks up type
  if type == text
    make a new text-oject/class with properties name, heading, content

  if type==section
    make a new section-object/class with properties color, size etc.

How do I achieve this in Ember, so that I have some kind of prototype for each content-type, and load the used properties from different db-relations?




Aucun commentaire:

Enregistrer un commentaire