我已经重复一个div通过角JS ng-repeat
<div ng-repeat="exampleData in example">
<input type="text" id="{{ $index }}percentage"/>
<button type="btn btn-success" ng-click="submitted('{{ $index }}fromHours')">Submit</button>
</div>
所以,当我点击提交按钮提交方法将输入精密组件ID通过为被称为参数吧,
请看看下面的JS代码:
$scope.submitted = function(percentage){
console.log($('#'+percentage).val());
}
现在,当我使用的参数,并打印出它的价值我得到的错误,说
Syntax error, unrecognized expression: #{{ $index }}percentage
我应该如何获得输入类型与{{$指数}}百分比ID的确切值
我已经写$指数具有独特的ID作为文本框将被重复很多倍。
请帮帮忙,在此先感谢:)
感谢它现在的工作:) – Harish
@Harish不错。如果这有帮助,一定要检查正确的答案 –