I'm trying to use Knockout component registration with requirejs module loader and it is not loading component files. No errors, no requests for the files. Does not seem to call the require function at all.
$(document).ready(function () {
require(['knockout-3.3.0'], function (ko) {
ko.components.register('rio-top-nav', {
viewModel: { require: 'Scripts/TopNavViewModel' },
template: { require: 'text!Content/TopNavView.html' }
});
});
});
here is my viewModel (declared in the file TopNavViewModel.js):
define(['knockout-3.3.0'],
function (ko) {
function TopNavigationViewModel() {
...
};
$.getJSON("/MyWebAPI/api/topnavigation", function (resp) {
var mv_TopNav = new TopNavigationViewModel();
....
ko.applyBindings(mv_TopNav);
});
return mv_TopNav ;
});
require.js is loaded, knockout-3.3.0.js is loaded. No idea whats happening, please help!
Thank you