如何使超链接移动到下一页,并将angularjs变量用于它?(How do I make hyperlink move to next page taking angularjs variable w

系统教程 行业动态 更新时间:2024-06-14 16:57:40
如何使超链接移动到下一页,并将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>

更多推荐

本文发布于:2023-04-13 12:19:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/ae32d51eef790b3f034d5d35b8bf1bb8.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:下一页   并将   变量   超链接   page

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!