嗨我在按功能通过ng-click传递ng-repeat参数时遇到问题。 我的重复是:
<tr ng-repeat="generalSurvey in surveys">
<td>
<% generalSurvey.survey.trans_id %>
</td>
<td>
<% generalSurvey.survey.created_at | date:'yyyy-MM-dd HH:mm:ss' %>
</td>
<td>
<% generalSurvey.save_answers_date | date:'yyyy-MM-dd HH:mm:ss' %>
</td>
<td>
<% generalSurvey.survey.base_survey.name %>
</td>
<td>
<% generalSurvey.survey.status.name %>
</td>
<td>
<div ng-click = "editCase( {{ generalSurvey.caseData.caseId }} )"><% generalSurvey.caseData.caseId %></div>
</td>
<td>
<% generalSurvey.caseData.firstContact %>
</td>
</tr>
下面我展示了我的指令代码:
link: function (scope, element, attrs) {
scope.surveys = {};
scope.getSurveys = function () {
surveysClient.getAll(function (callback) {
scope.surveys = callback.data;
console.log(scope.surveys);
});
};
// Pobranie danych o ankietach
scope.getSurveys();
scope.editCase = function (selectedCase) {
CicCase.get(parseInt(selectedCase), function (callback) {
console.log("siema");
});
}
},
我怎样才能正确传递这个参数?
答案 0 :(得分:2)
<{p}的ng-click
ng-click = "editCase( {{ generalSurvey.caseData.caseId }} )"
应该写成
ng-click = "editCase( generalSurvey.caseData.caseId )"
没有表达式语法{{}}