I've got the following code and I believe the ViewModel is structured correctly (I could be wrong) but I can't seem to access the values properly.
The JavaScript Pieces
NOTE: I'm using the Hot Towel SPA template with DurandalJS and <!-- ko compose --> style binding but I'm not showing that here to keep it simple.
var vm = {
activate: activate,
title: 'People',
people: [
new PersonItem('TestFirst', 'TestLast', '[email protected]', '111.111.1111', 'bio here'),
new PersonItem('TestFirst2', 'TestLast2', '[email protected]', '222.222.2222', 'bio here')
],
mytext: 'Oh Hey There'
};
return vm;
function PersonItem(firstname, lastname, email, phone, shortbio) {
var firstName = firstname;
var lastName = lastname;
var emailAddress = email;
var phoneNumber = phone;
var shortBio = shortbio;
var fullName = function () {
return firstName + " " + lastName;
};
var imagePath = function() {
return "/Content/images/Bio_" + firstName + "_" + lastName + ".jpg";
};
var resumePath = function () {
return "/Content/Resumes/resume_" + firstName + "_" + lastName + ".pdf";
};
The Binding I'm Trying
<div data-bind="text: mytext"></div>
<ul data-bind="foreach: people">
<li data-bind="text: firstName"></li>
</ul>
The Problem
I see a bullet is created, which seems to indicate the collection is being found, but the way I'm trying to access "firstName" doesn't seem to be working correctly.
I see the following (note that the text string is binding so I know knockout is doing its thing):

I know this is likely a simple oversight on my part but I just can't seem to see it and Google has me coming up empty (likely because I'm not sure exactly what to search for).