I'm trying to call a css class in one of the span tag that is within a template and it doesn't seem to work
Here is my viewmodel:
var data = [
{
'id': '1',
'firstName': 'Megan',
'lastName': 'Fox',
'picture': 'images/01.jpg',
'bio': 'Megan Denise Fox w'
},
{
'id': '1',
'firstName': 'asdf',
'lastName': 'asdf123',
'picture': 'images/02.jpg',
'bio': 'hwkhjkds lkawhkhkbs iklhskjha'
}
];
var viewModel = {
people: ko.observableArray(data),
myClass: ko.observable('test')
};
ko.applyBindings(viewModel);
And this is my view:
<h1>Profile Viewer</h1>
<div id="profilesTabViewer">
<ul id="profileTab" data-bind="template: { name: 'profileListTemplate',
foreach: people }">
</ul>
</div>
<script type="text/html" id="profileListTemplate">
<li>
<span data-bind="text: firstName, css: myClass"></span>
</li>
</script>
I have shared the code in http://jsfiddle.net/du3QX/11/