0
votes

Can somebody please help me figure out why I am getting my "AS.controller" is undefined error in javascript. Here is a jsfiddle : http://jsfiddle.net/deewen/5ZgaT/ In jsfiddle, the eror is

Uncaught TypeError: Cannot call method 'extend' of undefined

In my browser, I get

TypeError: AS.Controller is undefined

The ember code is :

window.AS = Ember.Application.create({
    LOG_TRANSITIONS: true
});

AS.baseURL = "/platformservices/";
AS.RESTAdapter = DS.RESTAdapter.extend({});

AS.Store = DS.Store.extend({
    revision: 12,
    adapter: 'AS.RESTAdapter'
});

AS.Router.map(function(){
    this.resource('analytics', {path: '/analytics'}, function(){
        this.resource('analyticsRuns',function(){
            this.resource('analyticsRun',{path: ':runId'});
        });
    });
});

AS.IndexRoute = Ember.Route.extend({
    redirect: function() {
        this.transitionTo('analytics');
    }
});

AS.AnalyticsIndexController = AS.Controller.extend({
    engagements : null,
    exercises : null,
    exerciseRuns : null,
//......
1

1 Answers

1
votes

The problem is this line:

AS.AnalyticsIndexController = AS.Controller.extend({

Unless you have defined AS.Controller somewhere outside your provided code, you're attempting to extend a class that doesn't exist. Most likely I suspect you meant to use Ember.Controller.

Also, a heads-up that if you're using the latest Ember Data (0.13 and above), you no longer require the revision: ... line for defining your store. I haven't checked whether keeping it would cause errors though.