Observable Where problem

Hi guys,

I have the following code which intended to filter an Observable array of objects using where clause.

var Pages = Observable();
Pages.add({
	PageTitle : "Profile",
	PageId : 1,
	isLoginRequired:false,
	GoToPage: "profilePage",
	isActive:false,
	PageIcon  : "order_13.png"
});
Pages.where({isActive:true})

the problem is, not data matches the where clause ! ?
Can you advise me ?

Best,
Ahmad

Hi Ahmed,

you should take a look at .where section in Observable docs which explains how to work with it.

Applied to your code, it should be something along these lines:

var Pages = Observable();
Pages.add({
	PageTitle : "Profile",
	PageId : 1,
	isLoginRequired:false,
	GoToPage: "profilePage",
	isActive:false,
	PageIcon  : "order_13.png"
});

var activePages = Pages.where({isActive:true});

module.exports = {
	activePages: activePages
};