samedi 12 décembre 2015

EmberJS how to include another Ember.Object file

Situation
I'm using EmberCLI for my Emberjs project. I created a directory called "custom_objects" with a file inside of it called 'person.js'

Emberjs Directory

LearningService (my app name)
  + app  
  + components  
  + controllers  
  + custom_objects
     -person.js*
  + helpers
  + models
  + routes
  + services
  + styles
  + templates

I am now working inside the components folder on a file called 'person-list.js' I want to make the person.js file available in person-list.js so I typed out the following:

custom_objects/person.js

import Ember from 'ember';

export default Ember.Object.extend({
   name: 'person'
});

components / person-list.js

import Ember from 'ember';
import Person from '../custom_objects/person.js';

export default Ember.Component.extend({

});

This is the error I get from the console

Uncaught Error: Could not find module `learning-services/custom_objects/person.js`   imported from `learning-services/components/person-list`

From the documentation I have read your supposed to use relative path and just include it as shown above.
• I have tried restarting Ember server

What am I missing?




Aucun commentaire:

Enregistrer un commentaire