So I have a view model like so:
var viewModel = function() {
var self = this;
this.chartSeries = ko.observableArray(['All Series']);
}
ko.applyBindings(new viewModel());
$(function (){
//I want to access it here
}
How do I accomplish this?
when I try viewModel().chartSeries, viewModel.chartSeries , viewModel.chartSeries() etc. I get undefined errors.
You are getting undefined errors because you don’t have an instance of the view model in scope. The easiest thing would be to do: