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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:39:43+00:00 2026-06-13T14:39:43+00:00

Please check this link is not working, i have no idea what is wrong

  • 0

Please check this link is not working, i have no idea what is wrong in my code.
I am trying to create a blog application, which have title, description and comments, but i am not getting proper output.

<h4>Title</h4>
<label data-bind="value: title" />
<h4>Description</h4>
<label data-bind="value: description" />
<h4>Comments</h4>
<p data-bind="foreach: comments">
    <label data-bind="value: commenter" /><br>
    <label data-bind="value: comment" /><br>
</p>​


var data = {"title": "blog1",
                "description": "Description1",
                "comments": [{"commenter": "commenter1", "comment": "comment1"},
                             {"commenter": "commenter2", "comment": "comment2"},
                             {"commenter": "commenter3", "comment": "comment3"},
                             {"commenter": "commenter4", "comment": "comment4"}]};
    function Comment(data) {
        this.commenter = ko.observable(data.commenter);
        this.comment = ko.observable(data.comment);
    }
    function BlogViewModel(data) {
        var self = data;
        self.title = data.title;
        self.description = data.description;
        self.comments = ko.observableArray(ko.utils.arrayMap(data.comments, function (com) {
            return new Comment(com.commenter, com.comment);
        }));
    }
    ko.applyBindings(new BlogViewModel(data));
​
  • 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-13T14:39:44+00:00Added an answer on June 13, 2026 at 2:39 pm

    You have multiple problems with your code some are related to KnockOut some of them are not:

    Which are not related to KO:

    • In BlogViewModel the self variable should hold this not the data parameter: so it should be var self = this;
    • Your comment mapping is wrong: the new Comment(com.commenter, com.comment) should be new Comment(com)

    Which are related to KO:

    • The value binding is used for input elements, you have labels so you need to use the text binding instead. E.g data-bind="text: title"
    • KO needs valid html. Because the self-closing label tag is not valid you need to add the closing tags to your labels e.g <label data-bind="text: description"></label>

    Here is a working JSFiddle containg all the fixes.

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

Sidebar

Related Questions

This is how I want it to be: Please check to this link and
Please check this code out it compiles and runs absolutely fine.. The question is
Can you guys please check this code, it is MVC3 Razor <p><strong><u>Skills:</u></strong> @foreach (var
I have created a DeclarativeServiceLibrary using VS2010 beta 2, Please check this image of
Could you please check out this piece of code: #include <vector> class A {
So I have this small application of mine I'm trying to deploy using visual
Please check http://www.udayan2k12.com/trial.html I have just copied the source from Google link (Source) Original
Please check this JSBIN link. http://jsbin.com/axeway/14/edit When you scroll the page you can see
I am trying to create a menu(no dropdown) using jquery. Please check some of
This jquery function working fine for button submit but not working for link button.

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.