Ember define objects with ember-cli


#1

Sry for noobish question.

Im trying to understand ember core concepts. Can anyone explain why this code dosnt work? app/app.js

import Ember from 'ember';
import Resolver from 'ember/resolver';
import loadInitializers from 'ember/load-initializers';
import config from './config/environment';

var App;
Ember.MODEL_FACTORY_INJECTIONS = true;
App = Ember.Application.extend({
  modulePrefix: config.modulePrefix,
  podModulePrefix: config.podModulePrefix,
  Resolver: Resolver
});

loadInitializers(App, config.modulePrefix);

var wife = Ember.Object.create({
  age: 21
})

export default App;

templates/application.emblem

  = outlet
  = wife.age

#2

Have you read about Routing in Ember.js? if not, go ahead to find answers in there.


#3

Can you using hbs instead of emblem? Emblem is not design for novice


#4

Your template does not have access to the wife variable.

Declare it in the Application Controller, and it will be available to your template.

Ideally, it will be set up as the model of your Route, but as I didn’t want to clobber too much your example, the following Twiddle respects your original code as much as possible in order to just make it work.


#6

You’ll also need another add-on to compile .emblem

ember install ember-cli-emblem

#7

i realy dont have any problems with emblem it works great

component-1.js

import Ember from 'ember';

export default Ember.Component.extend({
  emberobject1: "foe"
  ,
  actions: {
    doit: function(){this.set("emberobject1","bar")}
  }
});

component-1.emblem

button{action "doit"} example1

i dont know how to get access to ember object from another component or on DOM event.

i tried:

component-2.js

import Ember from 'ember';
import component-1 from '../components/component-1'
export default Ember.Component.extend({
});

component-2.emblem

button{action "doit" component-1} example2

#8

Is there anyone who can answer mby?