Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8196663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:33:27+00:00 2026-06-07T05:33:27+00:00

I have a code: Application = function() { Application.prototype.currentQuote.collection.fetch(); }; Application.prototype = {} Application.prototype.currentQuote

  • 0

I have a code:

Application = function() {
    Application.prototype.currentQuote.collection.fetch();
};

Application.prototype = {}

Application.prototype.currentQuote = {};
Application.prototype.currentQuote.model = new (Backbone.Model.extend({
    defaults: {
        products: []
    }
}))();

Application.prototype.currentQuote.collection = new (Backbone.Collection.extend({
    model: Application.prototype.currentQuote.model,
    url: 'test.json'
}))();

App = new Application();

But, when collection is fetched, i get “Uncaught TypeError: object is not a function” error.
I dont understand why, and what i can fix it?

You can see test case here: https://dl.dropbox.com/u/15806777/development/bb/index.html

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:33:29+00:00Added an answer on June 7, 2026 at 5:33 am

    I’d guess that your problem is right here:

    Application.prototype.currentQuote.collection = new (Backbone.Collection.extend({
        model: Application.prototype.currentQuote.model, // <------------------------
        url: 'test.json'
    }))();
    

    A collection’s model is:

    the model class that the collection contains.

    So the model should be something that comes from Backbone.Model.extend({...}) (i.e. “class”) rather than something that comes from new (Backbone.Model.extend({...})) (i.e. a model instance). When you ask a collection to create some models (through the constructor call, fetch, add, …), the collection needs something that it can use new on and you can’t new model_instance because the new operator needs a constructor function:

    The new operator creates an instance of a user-defined object type or of one of the built-in object types that has a constructor function.

    That’s where your “Uncaught TypeError: object is not a function” error comes from.

    You’ll need something like this:

    Application.prototype.currentQuote.Model = Backbone.Model.extend({
        defaults: {
            products: []
        }
    });
    //...
    Application.prototype.currentQuote.collection = new (Backbone.Collection.extend({
        model: Application.prototype.currentQuote.Model,
        url: 'test.json'
    }))();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my application code base with multiple activities in it. I have a
I have this code in my application If _oCurrentCall.CustomData.Length > 0 AndAlso UsageType =
I have to code in an application which is in Unicode UTF-8 in Windows,
I have following code in my application: // to set tip - photo in
I have following code in my Application. Comments in my code will specify My
I have following code in my application. [self.navigationController pushViewController:x animated:YES]; It will push a
I have code running in an iPhone application I am developing. Basically, the code
I have code in the top layer of my .Net web application that I'd
We have a 2,000,000 lines of code application in Mercurial. Obviously there is a
In many places in our application we have code like this: using(RAPI rapi =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.