I'm struggling with all the Script# Dependency loading.
I have a Script# Project referencing the knockout library. Which I got to work after some time with RequireJS.
Now I'd like to use KnockoutJS mapping which complies to something like
var model = ko.mapping.fromJS(data, {}, new ViewModel());
However ko.mapping is undefined.
If I manually (for testing only) change the compiled .js file to include mapping like this:
define('MyApp',
['ss', 'jquery', 'knockout', knockout.mapping],
function (ss, $, ko, mapping) { /*...*/ }
);
'mapping' is defined, but not as 'ko.mapping', which is how the compiler references it.
Any ideas?
This is my config:
requirejs.config({
paths: {
'jquery': 'jquery-1.9.1',
'jqueryValidation': 'jquery.validate',
'knockout': 'knockout-2.2.0',
'knockout.mapping': 'knockout.mapping-latest.debug',
'modernizr': 'modernizr-2.6.2'
},
shim: {
'jqueryValidation': ['jquery'],
'jquery.validate.unobtrusive': ['jquery', 'jqueryValidation'],
'jquery.unobtrusive-ajax': ['jquery'],
'knockout.mapping': ['knockout']
}
});