-2

I am trying to convert my web mapping application from legacy to AMD style. However, the error message tells the "TypeError: dojo.promise is undefined". I have tried to see if the error could come from the object "tasks" and "params". However, I can not tell anything wrong. Could anyone show me the solution?

1
  • 1
    Provide source code !!
    – Spring
    Feb 26 '16 at 11:04
1

obviously you still have the legacy code there, see "dojo.promise" part in your question. Wherever in your code you have this, you need to wrap it in the "require" or create your own module.

// from dojo documentation on promise/all
require(["dojo/promise/all"], function(all){

  all([promise1, promise2]).then(function(results){
    // results will be an Array
  });

  // -- or --

  all({
    promise1: promise1,
    promise2: promise2
  }).then(function(results){
    // results will be an Object using the keys "promise1" and "promise2"
  });

});

Promises, or deferred's are generally returned by many esri javascript api tasks.

Ufortunately, you provide very little in your question, I'd suggest you to read through the dojo migration documentation or some how-to docos regarding dojo AMD.

Not the answer you're looking for? Browse other questions tagged or ask your own question.