ko.bindingHandlers.check = {
init: function(element, valueAccessor) {
//var value = ko.unwrap(valueAccessor()); // Get the current value of the current property we're bound to
//$(element).toggle(value); // jQuery will hide/show the element depending on whether "value" or true or false
},
update: function(element, valueAccessor, allBindings) {
// Leave as before
debugger;
allBindings().value()['test'] = "test";
return
}
};
function VM() {
var self = this;
self.filter = ko.observable();
self.activeFilter = ko.observable({});
var ref = firebase.database().ref("florists");
var filter = {};
var activeFilter = {};
ref.once("value").then(function(florists){
florists.forEach(function(florist){
if (florist.val().products) {
var flowers = florist.val().products;
for (var flower in flowers) {
var currentFlower = flowers[flower];
for (var attribute in currentFlower.attributes) {
var currentAttribute = currentFlower.attributes[attribute];
for (var value in currentAttribute) {
if (!filter[attribute])
{
filter[attribute] = {};
//activeFilter[attribute] = {};
}
if (!filter[attribute][value])
{
filter[attribute][value] = 1;
//activeFilter[attribute][value] = "";
}
else
{
filter[attribute][value] += 1;
}
}
}
}
}
});
//console.log(filter);
self.filter(filter);
//self.activeFilter(activeFilter);
});
}
var vm = new VM();
ko.applyBindings(vm);
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.