javascript - calling angularjs scope function from href link from cshtml file -
this cshtml contents:
@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> }
this angularjs controller:
(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(); }); } }]); })();
i trying call ratingdetail() function href link mentioned in above cshtml. tried ng-click not worked. need , working examples. waiting exact solutions.
you mention tried working ng-click
didn't work, issue did have?
see primitive jsfiddle example working ng-click http://jsfiddle.net/lvc0u55v/12116/
Comments
Post a Comment