如何使超链接移动到下一页,并将angularjs变量用于它?(How do I make hyperlink move to next page taking angularjs variable with it?)
我有一个表格行填充了Json对象的数组。
实际上,我想单击其中一个行项目并移动到下一个页面,同时获取点击项目的ID。
我的代码:
AngularJS功能
$scope.findAllCompanies = function() { $http.get('http://blahblablah/company/all'). then(function(response) { $scope.companyList = response.data; }); }HTML:遍历companyList
<tr data-ng-repeat="company in companyList"> <td> <a href="/pages/company"> {{company.companyId}} </a> </td> <td> {{company.legalName}} </td> <td> {{company.dbaName}} </td> <td> {{company.formation}} </td> </tr>所以现在,如果我点击任何一行的companyId,页面应该被重定向到company.html?companyId = anyNum
我想在这里合并它们,像这样:
谢谢,并期待收到你的来信。
I have a table row being populated with the array of Json objects.
I actually want to click one of the row item and move to the next page by also taking the clicked item's id.
My Code:
AngularJS function
$scope.findAllCompanies = function() { $http.get('http://blahblablah/company/all'). then(function(response) { $scope.companyList = response.data; }); }HTML: traversing the companyList
<tr data-ng-repeat="company in companyList"> <td> <a href="/pages/company"> {{company.companyId}} </a> </td> <td> {{company.legalName}} </td> <td> {{company.dbaName}} </td> <td> {{company.formation}} </td> </tr>So now, If I click on companyId in any row, the page should be redirected to company.html?companyId=anyNum
I am thinking to merge them here, something like this:
Thanks, and looking forward to hear from you.
最满意答案
使用ng-href
<a ng-href="/pages/company?companyId={{company.companyId}}"> {{company.companyId}} </a>Using ng-href
<a ng-href="/pages/company?companyId={{company.companyId}}"> {{company.companyId}} </a>更多推荐
发布评论