I am new to requirejs and AMD module functions, and I am trying to pass a parameter from a require call, but I am running into some troubles. I am trying to pass the obj in a require call to the fun method. This require call is within a define method as shown in the code below. I following the instructions from this blog: http://blog.novanet.no/4-strategies-for-passing-parameters-to-requirejs-modules/
define(['require'],function(require){
var obj= {name:'random'};
require({
config : {
'tagging' : obj
}
},['fun'],function(promise){
promise.then(function(ret){
//do something.
});
}
}
Then I want to use the passed obj parameter in this below code. In fun.js
//Passing obj to fun.js
define(['module','lie'],function(data,Promise){
var promise = new Promise(function(res,rej){
//do something
});
}
But instead I am getting the following error on the console:
TypeError: depMaps.slice is not a function
Any clues on fixing this?
PS:Also if there are any better methods, kindly let me know.
Thanks,
{ config : { 'tagging' : obj } }to require call - Vishwanath