这是cshtml内容:
@model MBOS.DTO.ViewModel.Others.ReportTemplateViewModel<MBOS.DTO.ViewModel.BranchBOCAAnalysis>
@if (Model.IncludeTableHeader)
{<thead>
<tr class="no-borders">
<th>No.</th>
<th>Branch</th>
<th>Assessor</th>
<th>Rating</th>
</tr>
</thead>
}
@foreach (var row in Model.Models)
{
<tr>
<td>@row.Id</td>
<td>@row.Branch</td>
<td>@row.Assessor</td>
<td><a href="javascript:angular.element(document.getElementById('branchAnalysisCtrl')).scope().RatingDetail();">@row.Rating.FormatDouble() </a></td>
</tr>
}
这是AngularJs控制器:
(function () {
'use strict';
angular.module("app.branchAnalysis", ["app.base.report"])
.controller('branchAnalysisCtrl', ['$scope', '$http',
'appStore', '$controller', '$routeParams', 'Restangular', 'toaster',
'$location', '$q', '$filter',
function ($scope, $http, appStore, $controller, $routeParams, Restangular, toaster, $location, $q, $filter) {
$scope.RatingDetail = function () {
debugger;
restangular.one("dashboard/" + (type === 'b' ? 'boca' : 'aoca') + "/assessment/rating/" + assessment.BranchId + "/" + assessment.AssessmentMonth).get().then(function (response) {
if (type === 'b')
$scope.bocaStatusPieViewModel.RatingItems = response.plain();
else
$scope.aocaStatusPieViewModel.RatingItems = response.plain();
});
}
}]);
})();
我试图从上面的cshtml中提到的href链接调用RatingDetail()函数。 我试过ng-click但也没用。我需要一些好的和有效的例子。我在等待确切的解决方案。
答案 0 :(得分:0)
你提到你试图让它与ng-click
一起使用,但它不起作用,你有什么问题?
使用ng-click http://jsfiddle.net/Lvc0u55v/12116/
查看原始JSFiddle示例