angularjs 文件中没有 运行 函数
Function does not run in angularjs file
我的代码来自 Angular js 文件,
ctrl.issuesGridConfig = {
modelSetName: 'issues',
serializerChildName: 'issues', //will be prepended with "__" before fields for validation
actions: {
addRow: {
active: function(row) {return !ctrl.readOnly;},
callback: addIssueRow,
},
editRow: {
active: function(issue){ return issue.provider_issue_code;} ? true : false,
label: "View test" : "Edit",
callback: function(issue){
$location.path('/issue/' + issue.provider_issue_code);
}
},
deleteRow: {
active: function(row) {return !ctrl.readOnly;},
callback: function(row){
_.pull(ctrl.activity.issues, row);
}
}
},
我的问题是 - 在 Editrow 下我是 运行 函数(问题)。它在 callback: 中工作正常,但对于 active: 它不起作用。我在 callback: 下获得了 issue.provider_issue_code 的值,但在 active: 下却没有。仅当 issue.provider_issue_code 具有某些值时,我才想让 active = true 。请让我知道这里出了什么问题。
这里有错误的代码,由于您输入错误,active 始终为 true,在您的代码中,您使用三元运算符分配 active:active = condition ?真假; (函数就是那里的条件)
active: function(issue){ return issue.provider_issue_code;} ? true : false,
应该是
active: function(issue){ return issue.provider_issue_code ? true : false;} ,
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator
我的代码来自 Angular js 文件,
ctrl.issuesGridConfig = {
modelSetName: 'issues',
serializerChildName: 'issues', //will be prepended with "__" before fields for validation
actions: {
addRow: {
active: function(row) {return !ctrl.readOnly;},
callback: addIssueRow,
},
editRow: {
active: function(issue){ return issue.provider_issue_code;} ? true : false,
label: "View test" : "Edit",
callback: function(issue){
$location.path('/issue/' + issue.provider_issue_code);
}
},
deleteRow: {
active: function(row) {return !ctrl.readOnly;},
callback: function(row){
_.pull(ctrl.activity.issues, row);
}
}
},
我的问题是 - 在 Editrow 下我是 运行 函数(问题)。它在 callback: 中工作正常,但对于 active: 它不起作用。我在 callback: 下获得了 issue.provider_issue_code 的值,但在 active: 下却没有。仅当 issue.provider_issue_code 具有某些值时,我才想让 active = true 。请让我知道这里出了什么问题。
这里有错误的代码,由于您输入错误,active 始终为 true,在您的代码中,您使用三元运算符分配 active:active = condition ?真假; (函数就是那里的条件)
active: function(issue){ return issue.provider_issue_code;} ? true : false,
应该是
active: function(issue){ return issue.provider_issue_code ? true : false;} ,
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator