【发布时间】:2017-03-22 06:47:54
【问题描述】:
我正在尝试使用 ng-repeat 中可用的 ng-click 重定向页面。
-
ng-重复代码:
<tr ng-repeat="students in studlist" ng-click="gotoProfile(1)"> <td width="12%" class="student-list-pic-column"><img src="<?=base_url()."data/student-img/{{ students.photo }}";?>"></td> <td width="50%" class="custom-table-border-body text-left">{{ students.studname }}</td> <td width="38%">{{ students.bid }}</td> </tr> <tr ng-show="!studlist.length"> <td colspan="3" class="custom-table-border-body text-center"> Search student name ... </td> </tr>
这里在 ng-click="gotoProfile(1)" 而不是那个 1 我需要 {{students.id}} 但无法获得
-
控制器功能:
$scope.gotoProfile = 函数 (sid) { 控制台.log($scope.purl); var rurl = $scope.purl+sid; $location.url(rurl); };
当我运行这个时,我得到了 url
像这样。
请帮忙。 谢谢你 普拉尚特
【问题讨论】:
-
gotoProfile(students.id) 应该可以工作。
-
@Ved 感谢 ved.. 一个问题已经解决.. 但仍然卡在重定向 url。它附加该网址而不是重定向.. :(
-
有什么问题?
-
$scope.gotoProfile = function (sid) { console.log($scope.purl); var rurl = $scope.purl+sid; $location.url(rurl); };这里我需要网址:localhost/product/tcm_dev/utility/student/profile/1 但点击后它看起来像localhost/product/tcm_dev/utility/dashboard#/http://localhost/…
-
你得到了什么:$scope.purl+sid
标签: angularjs