Angular2:ts - 提供的参数与调用目标的任何签名都不匹配

时间:2017-06-12 14:51:20

标签: javascript angular typescript

下面是具有根据我的业务需求更改行,列的逻辑的代码。当我保留这段代码时,在我的Angular2 ts代码中,我得到的提供参数与.forEach中的任何调用目标错误签名都不匹配(...

<div id="content"></div>

1 个答案:

答案 0 :(得分:1)

As others mentioned in order to use self executing function with parameters you need to provide those parameters.

let myCol; // or you can set this to an initial value
let myRow;

data.forEach(function (col, row) {
            return function (o) {
                // your logic here
            };
        }(myCol, myRow));

Your typescript compiler is complaining because your function takes two parameters col and row but you are invoking it without any parameter.