简体   繁体   English

Angularjs Button在ng-repeat中加载状态指令

[英]Angularjs Button loading state directive within ng-repeat

I am looking to expand upon a previously resolved question: 我希望扩展以前解决的问题:

Angularjs Button loading state directive with ng-disabled directive Angularjs Button使用ng-disabled指令加载state指令

This directive is working perfectly for a button based upon a single instance, however when applied within an ng-repeat, all of the buttons created change their state when one button is clicked. 该指令适用于基于单个实例的按钮,但是当在ng-repeat中应用时,所创建的所有按钮在单击一个按钮时会改变其状态。 Is there a way to make this directive work so that when this directive is applied to multiple buttons within an ng-repeat, only the button clicked changes its loading state? 有没有办法使这个指令工作,以便当这个指令应用于ng-repeat中的多个按钮时,只有点击的按钮才会改变其加载状态?

I created a plunker to demonstrate what the problem is: http://plnkr.co/edit/epdPhwx27RlthzLPXf67?p=preview 我创建了一个plunker来演示问题所在: http ://plnkr.co/edit/epdPhwx27RlthzLPXf67?p = preview

Here is a way to do it with your same plunker. 这是一种使用相同的plunker来做到这一点的方法。

Button-Loading Plunker 按钮式装载机

I changed the way you looked at the data. 我改变了你看待数据的方式。 Notice $scope.array, and $scope.load, as well as the data found in the button element. 注意$ scope.array和$ scope.load,以及button元素中的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM