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

  • Home
  • SEARCH
  • 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 8387187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:08:39+00:00 2026-06-09T18:08:39+00:00

class ViewModel constructor: -> $.ajax({url: ‘#.json’, type: ‘GET’, dataType: ‘json’}) .done @buildModel buildModel: (data)

  • 0
class ViewModel
  constructor: ->
    $.ajax({url: '#.json', type: 'GET', dataType: 'json'})
    .done @buildModel

  buildModel: (data) =>
    @model = ko.mapping.fromJS(data)
    @model.update = =>
      delete @model.update
      jsonForm = ko.mapping.toJSON(@model)
      $.ajax({url: '#.json', data: jsonForm, type: 'PUT', contentType:"application/json; charset=utf-8", dataType: 'json'})
      .done @buildModel

    ko.applyBindings(@model)

###################################################################

class FormViewModel extends ViewModel
  buildModel: =>
    super()

If I call this:

$(document).bind 'pageinit', =>
  @form = new ViewModel

everything is fine. If I try to inherit

$(document).bind 'pageinit', =>
  @form = new FormViewModel

getting an error:

Uncaught Error: Unable to parse bindings.
Message: ReferenceError: update is not defined;
Bindings value: click: update 

Why ko.applyBindings is not happy with this inheritance?

  • 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-09T18:08:41+00:00Added an answer on June 9, 2026 at 6:08 pm

    Use super instead of super() in FormViewModel‘s buildModel function.

    • super() means: call the parent method of the same name, without any arguments.
    • super means: call the parent method of the same name, with whatever arguments I received.

    So the subclass was always calling the parent buildModel function with data = undefined.

    Also note that I don’t think you should need to call ko.applyBindings in the buildModel function. The call should only need to happen once for the entire view model.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm passing data between my controller and my view using a ViewModel class. When
I have this ViewModel public class CustomerSuscribeViewModel : IValidatableObject { [DataMember(IsRequired = true)] [DataType(DataType.Text)]
I have the following ViewModel public class RecommendationModel { public List<CheckBoxItem> CheckBoxList { get;
I have a viewmodel. public class RegistrationViewModel { public RegisterModel Register { get; set;
I have a player class and viewmodel class Player constructor: -> @boat = ko.observable
I have the following code as the constructor of a ViewModel class: [ImportingConstructor] public
I put some data access logic in my default construct of ViewModel class. However,
I have a class that roughly looks like this: public class ViewModel { public
What am I missing here? ViewModel: public class ViewModel { public IDictionary<int, string> Entities
I have a ViewModel class that contains a list of points, and I am

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.