我有一个函数定义了这个以在模型中调用但是如何在控制器中调用该函数? Angular生成错误
TypeError:这是未定义的
示例代码
this.addForms = function addForms (param1, param2) {
//function code
}
function auxFunction () {
this.addForms (0 , 1);
}
答案 0 :(得分:0)
this.addForms = function addForms (param1, param2) {
//function code
}
var self = this; //i.e just answered by @Nephelococcygia
function auxFunction () {
self.addForms (0 , 1);
}