Cannot call method indexOf undefined

I'm getting the error, cannotcall method indexOf 'undefined' when using the ko utils array Filter . . .

View Model:

viewModel.People = ko.mapping.fromJS(people);


self.Filter1 = ko.observable();    



self.FilteredSystem = ko.computed(function () {

    var Filter1 = self.Filter1();


        return ko.utils.arrayFilter(viewModel.People(), function (People) {

            return ((People.Name.indexOf(Filter1) !== -1));

        });


}, self);

Answers


Because you used the mapping plugin, the Name property is going to be an observable and you have to unwrap it (People.Name().indexOf...) to get its value.


Need Your Help

What's the point of the --without option in bundle install?

ruby bundler

If your app doesn't need the gems in a certain group, why can't you just let bundler install them with a regular bundle install, and then simply not use them? Is it just a cleanliness issue - i.e. ...

How can I add a href link to another page in DjangoCMS index page

django django-templates django-cms

I have a website developed using DjangoCMS and I tried to add a href to another page (site.com/en/blog). Unforunately none of my tries went well: