Knockout.js mapping plugin with require.js
- by Ravi
What is the standard way of loading mapping plugin in require.js ?
Below is my config.js (require.js config file)
require.config({
// Initialize the application with the main application file.
deps:["app"],
paths:{
// JavaScript folders.
libs:"lib",
plugins:"lib/plugin",
templates:"../templates",
// Libraries.
jquery:"lib/jquery-1.7.2.min",
underscore:"lib/lodash",
text:'text',
order:'order',
knockout:"lib/knockout",
knockoutmapping:"lib/plugin/knockout-mapping"
},
shim:{
underscore:{
exports:'_'
},
knockout:{
deps:["jquery"],
exports:"knockout"
}
}
}
In my view model
define(['knockout', 'knockoutmapping'], function(ko, mapping) {
}
However, mapping is not bound to ko.mapping. Any pointers/suggestions would be appreciated.
Thanks,
Ravi