0

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 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks that was it, I really needed second set of eyes on this. Thanks again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.