你可以看到上面的代码链接。
其实我想按钮组的输入来控制所有与按钮组名称相同的输入格式。
例如,我把值到输入表单上的“第一”按钮右侧,
,并在同一时间,所有的输入形式名称“第一”的应改变
只按钮组输入一个。
对不起,我的英语能力差,希望你能理解它!
<div ng-app="app" ng-controller="AppCtrl">
// list group
<div>
<ul>
<li ng-repeat="item in items">
<span>{{item.name}}</span>
<input type="text" ng-model="price">
</li>
</ul>
</div>
// button group
<div>
<ul class="list-btn">
<li ng-repeat="btn in btns">
<button>{{btn}}</button>
<input type="text" ng-model="price_all">
</li>
</ul>
</div>
</div>
angular.module('app', [])
.controller('AppCtrl', ['$scope', function ($scope) {
$scope.items = [
{id: 1, name: 'First'},
{id: 2, name: 'Second'},
{id: 3, name: 'Third'},
{id: 4, name: 'First'},
{id: 5, name: 'Second'},
{id: 6, name: 'Third'},
{id: 7, name: 'First'},
{id: 8, name: 'Second'},
{id: 9, name: 'Third'},
]
$scope.btns = ['First', 'Second', 'Third'];
}])
请把代码放在帖子里? jsFiddle真棒,但它更好[把你的代码放在问题中](http://meta.stackexchange.com/questions/149890/prevent-posts-with-links-to-jsfiddle-and-no-code) – evolutionxbox
你需要点击按钮来反映更改还是立即? –
使用服务来存储数据,你将拥有全部自动同步 – thegio