0

I am trying to add this list into my view model in order to make some bindings a little bit simpler. However, I can't figure out the syntax in order to do so.

        var images = [
          { name: "Image 1", photo: "/images/image1.jpg" },
          { name: "Image 2", photo: "/images/image2.jpg" },
          { name: "Image 3", photo: "/images/image3.jpg" },
        ];

      var viewModel = {
          favorite: "",
       ...
      }
1
  • If you need to know how to access it in a data-win-bind check out this question Commented Mar 3, 2014 at 21:50

1 Answer 1

1

Assign images to viewModel like this:

  var viewModel = {
      favorite: "",
      images: images
  };

Then access them like this viewModel.images

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.