var templateFromUrlLoader = {
    loadTemplate: function (name, templateConfig, callback) {
       
        if (templateConfig.fromUrl) {
            // Uses jQuery's ajax facility to load the markup from a file
            var fullUrl = 'scripts/templates/' + templateConfig.fromUrl + '?cacheAge=' + templateConfig.maxCacheAge;
            $.get(fullUrl, function (markupString) {
                // We need an array of DOM nodes, not a string.
                // We can use the default loader to convert to the
                // required format.
                ko.components.defaultLoader.loadTemplate(name, markupString, callback);                
            });
        } else {
            // Unrecognized config format. Let another loader handle it.
            callback(null);
        }
    }
};

ko.components.loaders.unshift(templateFromUrlLoader);

ko.components.register("body", {
    template: { fromUrl: 'body.html' }
})

ko.components.register("navbar-external", {
    template: { fromUrl: 'navbar.html' },
});
ko.components.register("menu-items", {
    template: { fromUrl: 'menu-items.html' },
});
ko.components.register("cart-inline-footer", {
    template: { fromUrl: 'cart-inline-footer.html'},
});
ko.components.register("settings", {
    template: { fromUrl: 'settings.html' }
})
ko.components.register("cart-temp", {
    template: { fromUrl: 'cart.html' }
})

ko.components.register("message-box", {
    template:{ fromUrl:'messagebox.html'}
});

ko.components.register("cart-new-template", {
    template: { fromUrl: 'cart-new-template.html' }
});

ko.components.register("settings-new-template", {
    template: { fromUrl: 'new-settings-template.html' }
})
ko.components.register("dinner-table-list", {
    template: { fromUrl: 'dinner-table-list.html' }
})
//dinner-table-list-2
ko.components.register("dinner-table-list-2", {
    template: { fromUrl: 'dinner-table-list-2.html' }
})
ko.components.register("code-reader-result", {
    template: { fromUrl: 'qrcode-reader-result.html' }
});
ko.components.register("code-reader", {
    template: { fromUrl: 'qrcode-reader.html' }
})
ko.components.register("product-detail", {
    template: { fromUrl: 'product-detail.html' }
})
ko.components.register("product-edit", {
    template: { fromUrl: 'product-edit.html' }
})