Html 如何将div模式与ng repeat一起使用
我想将循环索引传递给函数Createprofile()。我想用角度控制器来做这个 HTMLHtml 如何将div模式与ng repeat一起使用,html,angularjs,Html,Angularjs,我想将循环索引传递给函数Createprofile()。我想用角度控制器来做这个 HTML {{proteam.description}} &时代; 协作表 输入团队名称: 合作 您可以在ng repeat中使用跟踪 <li ng-repeat = "proteam in proteams | filter:filtText | filter:filtText1 track by $index" ng-init="counter"> <form ng-submit="c
{{proteam.description}}
&时代;
协作表
输入团队名称:
合作
您可以在ng repeat中使用跟踪
<li ng-repeat = "proteam in proteams | filter:filtText | filter:filtText1 track by $index" ng-init="counter">
<form ng-submit="createProfile($index)"
然后您可以在ng repeat中使用它
<li ng-repeat = "proteam in proteams | filter:filtText | filter:filtText1 track by $index" ng-init="counter">
<form ng-submit="createProfile($index)"
将此作为
<form ng-submit="createProfile($index)" onkeypress="return event.keyCode != 13;">
ng repeat
需要一个数组,因此它有一个与其关联的索引
检查下面的代码。每次单击表单的索引都会发出警报
angular.module('myApp',[])
.controller('myCtrl',函数($scope){
$scope.createProfile=函数(html){
警报(html);
}
$scope.proteams=[{'description':'stack'},{'description':'overflow'}]
});代码>
-
{{proteam.description}}
&时代;
协作表
输入团队名称:
合作
这是我使用track bycode
angular.js:12722错误:[filter:notarray]at error(native)at oh抱歉,track by$index应该是最后一个。试试看。这不起作用,因为$index无法跟踪。