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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:25:16+00:00 2026-06-12T18:25:16+00:00

When the following foreach gets bound, I need to be able to have a

  • 0

When the following foreach gets bound, I need to be able to have a view add html to the ‘body’ div either from an $.get or just hardcoded. I need ‘model’ to be that vm, but i dont know how i can get the vm to add html to the page

<!--ko foreach:modules -->
<div class="module" data-bind="attr: {id:id}">
    <div class="head" data-bind="text:title"></div>
    <div class="body" data-bind=""></div>
</div>
<!-- /ko -->


my.Module = function (mod) {
    var m = mod || { },
        id = m.id || new Date().getTime(),
        css = ko.observable(m.css || { }),
        title = ko.observable(m.title || 'New Module'),
        privy = ko.observable(),
        model = ko.observable(new my.Models.DailyStatus());
    return {
        id: id,
        css: css,
        title: title,
        privy: privy,
        model: model
    };
};

my.Models.DailyStatus = function () {

    var venues = ko.observableArray(),
        init = function () {
            //Get HTML specific to my needs
            //Add to desired area of page
            //?????


            // Get data to fill venues
            update();
        },
        update = function () {
            my.service.getNewVenues(function (c) {
                venues(c.d.Payload);
            });
        };

    init();
    return {
        init: init,
        update: update,
        venues: venues
    };
};

is there a way that my Model can know what element will be his host?

  • 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-12T18:25:18+00:00Added an answer on June 12, 2026 at 6:25 pm

    This was answered in the comments so I figured I would move it to something I can select as an answer.

    The ‘html’ binding was all that was needed.

    For my particular needs I couldn’t seem to get ko bindings within the inserted html to render/take action so I switched to using a template tag with a function as its value which also provided a valid way to insert the html.

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

Sidebar

Related Questions

I got a question. i have tha following foreach loop: {foreach from=$films item=film key=id}
I have the following php array that gets all values from a form full
I have the following code in my smarty template: {foreach from=$categories item=l} <tr>----------START---------------</tr> <br/>
I have the following sample code which gets a list of values from a
I have the following script which loops through a HTML table and gets the
I have the following code foreach (DataRowView dr in Data) { if (dr ==
I have the following code: foreach (Tuple<Point, Point> pair in pointsCollection) { var points
I have the following code: foreach (var control in this.Controls) { } I want
I have the following code: foreach (ListItem item in check.Items) { if (item.Selected) {
Suppose I have the following code: foreach(string str in someObj.GetMyStrings()) { // do some

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.