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 7915977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:38:17+00:00 2026-06-03T14:38:17+00:00

I edit my code again and I got the following 2 error : 1)

  • 0
  • I edit my code again and I got the following 2 error :

1) Complex_collection is not defined

  model: Complex_model

2) Complex_model is not defined

 model: Complex_model

I am using backbone js following is my code and I done this by using backbone.js but my code is not running I want separate model , view and controller using backbone js

//model

(function(){ var Complex_model = Backbone.Model.extend({        
    sync:function() {},
    validate:function() {},
    url:function() {},          
    defaults :{
        name : null
    }    
});})(this);

//view

(function(){

FriendView = Backbone.View.extend({
    events :{
        'click #add-input' : 'add'
    },
    initialize: function(){
        this.collection = new Complex_collection(); // This is collection
        _.bindAll(this, 'render');
    },      
    add : function() {
        alert("hello");
        var friend_name = $('#input').val();
        this.collection.add({ name : friend_name });
    },
    render : function(){
        $("#friends-list").append("<li>"+ model.get("name")+"</li>");
    },      
});

var view = new FriendView(); })(this);

//collection

(function(){    

    var Complex_collection = Backbone.Collection.extend({

    model: Complex_model

});})(this);

thank you

  • 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-03T14:38:18+00:00Added an answer on June 3, 2026 at 2:38 pm

    You should not create new instance of the same object in the initialize code, your code should look something like this :

    (function(){ 
        this.complex_model = Backbone.Model.extend({        
            sync:function() {},
            validate:function() {},
            url:function() {},      
        });
    })(this);
    
    // View
    
    (function(){
        var vw = view = function(){};
        FriendView = Backbone.View.extend({
            events :{
                'click #add-input' : 'add'
            },
            initialize: function(){
                this.friendslist = new FriendList(); // This is your collection right?
                _.bindAll(this, 'render');
            },      
            add : function() {
                var friend_name = $('#input').val();
                this.friendslist.add({ name : friend_name });
            },
            render : function(){
                $("#friends-list").append("<li>"+ model.get("name")+"</li>");
            },      
        });
    })(this);
    
    // Collection
    (function(){    this.complex_collection = Backbone.Collection.extend({
        model : complex_model
    });})(this);
    
    // Your main app
    var view = new FriendView();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting a StackOverflow Error in this code: EDIT [XmlAttribute(ID)] public string ID
Hello i got a problem with my mysql code it gives the following error
EDIT: This code now works correctly, I only left it in case someone finds
EDIT: My main code no longer works, should this function work? <script type=text/javascript src=jquery-1.7.2.js></script>
Thanks to the help in a previous question , I've got the following code
Please ignore code readability in this question. In terms of performance, should the following
I got an .ipa file from a customer (without source code access). This app
A very strange situation, I've got this code that is supposed to make an
i got this piece of code: - (void)postToWall { FBStreamDialog *dialog = [[FBStreamDialog alloc]
I got this textfield in Rails, I entered this in edit: Lifts 09:00-00:45 mid-Jun-Aug

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.