Table Angular js中的HTML链接

标签 html angularjs

我正在使用 Angular js; 在我的 View 模板中,我有一个表 我希望表格中由模型中的元素填充的每一行都可以链接到另一个页面。 我尝试了注释的代码行,但它不起作用!

感谢您的帮助! 干杯!

<section data-ng-controller="AllsController" data-ng-init="find()">
<div class="page-header">
    <h1>Alls</h1>
</div>

<div class="list-group">

    <table class="table table-striped table-bordered">
        <thead>
            <tr>
                <th>Created</th>
                <th>User</th>
                <th>Name</th>
                <th>Color</th>
            </tr>
        </thead>
        <tbody>
                <tr data-ng-repeat="all in alls">
                <!-- <a data-ng-href="#!/alls/{{all._id}}" > -->

                <td data-ng-bind="all.created | date:'medium'"></td>
                <td data-ng-bind="all.user.displayName"></td>
                <td data-ng-bind="all.name"></td>
                <td data-ng-bind="all.color"></td>

                <!-- </a> -->
            </tr>
        </tbody>
    </table>
</div>

最佳答案

你可以做类似的事情 <tr ng-click="onClick()">在您的 onClick 函数中,您可以编写您的逻辑。如果你想重定向到某个页面,你可以使用 angularjs 的 $location 服务。

关于Table Angular js中的HTML链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30400820/

相关文章:

javascript - AngularJS slider - 路由问题(我无法正确路由我的按钮/页面)

javascript - 设置 AngularJS 时遇到问题

javascript - sqlexception消息显示导致页面错误

javascript - Opera SDK开发

html - img-circle 类不对图像进行四舍五入

javascript - 如何根据浏览器加载不同的javascript库?

javascript - 使用 angular/d3/css3/(?) 通过动画树状图创建体验

html - 如何在没有显式标记的情况下更改已定义关键字的样式。

javascript - pdfMake无法读取未定义的属性 '_calcWidth'

twitter-bootstrap - Uncaught Error : No module: ui. Bootstrap