javascript - 将 AngularJS 对象值从 ng-repeat 传递到 AngularJS 函数

标签 javascript angularjs model-view-controller

我正在拼命尝试将 Angular 对象值传递给函数。各种尝试都没有取得任何进展,只有当我对值进行硬编码时,我才能让它正常工作。

MVC View :

<tr ng-repeat="project in projects | filter:search:strict">
<td><span><a style="cursor:default" title="Ändra i projektet.." id="{{project.id}}" data-ng-click="opents('/EditProject/', '{{ project.id }}')">{{ project.id }}</a></span></td>

Angular 函数:

$scope.opents = function (tsUrl, id) {
        alert('/EditProject/'+ $attrs);
        alert(tsUrl);
        alert(id);
        alert(tsUrl + id);
        TINY.box.show({ url: tsUrl + id });
    };

我尝试从 View 中的调用接收不同的值,因此出现了许多警报。从网上找不到解决方案,希望有人知道解决方案。

最佳答案

尝试:

ng-click="opents('/EditProject/', project.id)"

关于javascript - 将 AngularJS 对象值从 ng-repeat 传递到 AngularJS 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26135104/

相关文章:

javascript - AngularJS - 将对象传递给属性时动态加载模板URL

model-view-controller - ir.ui.view 中 iframe 的 Odoo 8 src 变量

javascript - 如果数据项不提供 "id"和 "text"字段名,如何将 select2 与远程数据一起使用?

javascript - 将第二个服务注入(inject) Controller AngularJS 时遇到错误

javascript - 读取cookie返回未定义

node.js - AngularJS:通过 https 使用 socket.io 聊天应用程序

model-view-controller - 我在哪里放置格式化逻辑?

c# - 为什么会出现 "Could not create an instance of type Microsoft.AspNetCore.Http.IFormFile"错误?

javascript - Electron: app.on ('ready' ) 永远不会被调用

javascript - Gulp.js 不会重新加载纯 CSS