I'm attempting to use the MVVM framework to bind an array of objects to some templates. In my scenario, assume I have an array of animals. I want to use a different template for each animal. How can this be accomplished?
The code might look like this:
With HTML that looks like:
The code might look like this:
var vm = kendo.viewModel({ animals: []}); vm.animals.push(new Cat());vm.animals.push(new Dog()); kendo.bind("#farm", vm);With HTML that looks like:
<div id="farm"><div data-template="animal-template" data-bind="source: animals"></div></div> Here is where I would define the different templates for each animal