The following code is what I had:
function Page(viewModel) {
/** --- VARIABLES --- */
var self = this;
var self.viewModel = viewModel;
/** --- METHODS --- */
self.init = function() {
$('.search-btn').on('click', function() {
alert('hello');
});
};
self.updateSearch = function() {
viewModel.results.push('s');
};
}
Can you spot the mistake?
It's here:
var self.viewModel = viewModel;
To fix it, make it so:
var viewModel = viewModel;
No comments:
Post a Comment