且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

试图让NG-CSV与火力地堡工作

更新时间:2023-11-30 15:53:04

您几乎没有。弗兰克面包车Puffelen是在正确的道路上,但戛然而止您code提供修复程序。

You are almost there. Frank van Puffelen was on the right path, but stopped short of providing the fix for your code.

return test;

您的回调里面上面的语句返回一个承诺内的结果。这个结果只能使用承诺意识到code被消耗掉。幸运的是,NG-CSV接受的承诺。如果返回的承诺它应该工作:

the above statement inside your callback is returning the result inside a promise. This results can only be consumed using promise aware code. Fortunately, ng-csv accepts a promise. If the promise is returned it should work:

this.export = function() {
  var results = fireFactory.getResults()
  //Here we return the promise for consumption by ng-csv
  return results.$loaded().then(function(array) {
    var test= [];
    test.push(array[0]);
    test.push(array[1]);
    //the array is returned from the callback, not export
    return test;
  };
};