1
votes

I'm using Ember App Kit (EAK).

The Ember Inspector / Chrome Dev Tools console shows this line when I load my index page:

*generated -> controller:application Object {fullName: "controller:application"}*

But I've explicitly created an Application Controller, which this Ember app apparently doesn't know about (since it's autogenerating an ApplicationController).

I'm trying to call a title property on my explicit Application Controller, and display it in my application template.

What am I doing wrong? The {{title}} in the template yields nothing.

(I suspect it has to do with the way EAK uses ECMAScript 6 modules via the ES6 Module Transpiler.)


/site/app/templates/application.hbs

{{title}}

{{outlet}}

/site/app/controllers/application.js

var ApplicationController = Ember.Controller.extend({
    title: 'hello world'
});

export default ApplicationController;

2

2 Answers

1
votes

Your code seems ok to me. Which Ember.js and app-kit versions do you use?

I tried to replicate your issue but everything worked well. Can you please replicate my scenario and verify that it also works for you?

What I did:

$ git clone [email protected]:stefanpenner/ember-app-kit.git
$ cd ember-app-kit
$ npm install

Made these code changes (my git diff):

diff --git a/app/controllers/application.js b/app/controllers/application.js
new file mode 100644
index 0000000..9d34ee0
--- /dev/null
+++ b/app/controllers/application.js
@@ -0,0 +1,5 @@
+var ApplicationController = Em.Controller.extend({
+    title: 'hello world'
+});
+
+export default ApplicationController;
diff --git a/app/templates/application.hbs b/app/templates/application.hbs
index d08c11f..a373a71 100644
--- a/app/templates/application.hbs
+++ b/app/templates/application.hbs
@@ -1,3 +1,4 @@
 <h2 id='title'>Welcome to Ember.js</h2>
+{{title}}

 {{outlet}}

and finally ran

$ grunt server

and when I opened localhost:8000 everything worked fine ("hello world" was rendered). Can you please try it out?

2
votes

Sometimes helps to restart your grunt server.