我有一个标记为保存的按钮。 我希望它在有人更改其对应的文本框值时显示。如何在angularjs中做到这一点。 但是现在 我点击更改文本框中的内容,同时ng-repeat中的所有按钮将同时处于活动状态
increaseQty:function(){
qty++;
}
<div ng-repeat="test in tests">
<label>{{test.price}}</label>
<label>{{text.qty}}</label>
<button>increase qty</button>
</div>
但是问题是所有产品的数量都得到更新。
答案 0 :(得分:0)
您在问题中解释了两种不同的情况。无论如何,我会尝试回答与您添加的代码有关的问题。 基本上,您需要通过记录,您需要为其更新数量,如下所示。
$scope.increaseQty = function(item){
item.qty++;
}
在下面的js小提琴链接中查看有关此内容的更多信息。
答案 1 :(得分:0)
当相应的价格或数量改变时,它将显示一个按钮。
<canvas id="lineChartTest" width="921" height="460">
<script>
document.addEventListener("DOMContentLoaded", function(event) {
(function() {
"use strict";
let ctx = document.getElementById("lineChartTest");
window.lineChartTest = new Chart(ctx, {
type: 'line',
data: {
labels: ["2018-09-03","2018-09-04","2018-09-05","2018-09-06","2018-09-07","2018-09-08","2018-09-09","2018-09-10","2018-09-11","2018-09-12","2018-09-13","2018-09-14","2018-09-15","2018-09-16","2018-09-17","2018-09-18","2018-09-19","2018-09-20","2018-09-21","2018-09-22","2018-09-23","2018-09-24","2018-09-25","2018-09-26","2018-09-27","2018-09-28","2018-09-29","2018-09-30","2018-10-01","2018-10-02","2018-10-03"],
datasets: [{"label":"Emails Sent","backgroundColor":"rgba(38, 185, 154, 0.31)","borderColor":"rgba(38, 185, 154, 0.7)","pointBorderColor":"rgba(38, 185, 154, 0.7)","pointBackgroundColor":"rgba(38, 185, 154, 0.7)","pointHoverBackgroundColor":"#fff","pointHoverBorderColor":"rgba(220,220,220,1)","data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,746,52,147,47,8]}]
},
});
})();
});
</script>
</canvas>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="panel-heading"></div>
<div class="card-body graph-loader">
<h5 class="card-title">
Emails Sent (Last 30 Days)
</h5>
<div class="pt-4 px-3" id="graph">
</div>
</div>
</div>
</div>