如何使用angular可以获得this
.coefficient
值?我试图使用下面的代码ng-click
,但我可以得到整个HTML只为第一.coefficient
价值(我有这样一个巨大的一堆收音机)。我可以用jquery解决这个问题,但是我需要将.coefficient
的值乘以动态添加输入。使用angularjs获取元素的值
$scope.getCoeff = function(){
var coefficient = document.body.querySelector('.coefficient');
console.log(coefficient);
}
<label class="bet-team-box" for="radio-1">
<input class="bet-main-input" id="radio-1" name="group1" type="radio" ng-click="getCoeff()">
<span class="fake-label">
<span class="team">Midnight Sun Esports</span>
<span class="img-box"><img src="images/logo-team-04.png" alt="image description" width="20" height="20" /></span>
<span class="coefficient">12.43</span>
</span>
</label>
你能换一个指令,所有的电台吗? – gianni
你能用你的代码做一个小提琴吗? – NNR
@gianni是的,没问题 –