Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 来自输入AngularJS的编号_Javascript_Angularjs - Fatal编程技术网

Javascript 来自输入AngularJS的编号

Javascript 来自输入AngularJS的编号,javascript,angularjs,Javascript,Angularjs,单击后,我不想在console.log$scope.value中显示我在其中选择数字的输入 我的代码: <table class="table table-bordered table-striped"> <thead> <tr> <th >Name

单击后,我不想在console.log
$scope.value
中显示我在其中选择数字的输入

我的代码:

 <table class="table table-bordered table-striped">
                        <thead>
                        <tr>
                            <th >Name
                            <th >System
                            </th>
                            <th>Actions</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="n in data">
                            <td style ="word-break:break-all;">{{n.name}}</td>

                            <td style="width:35px;">{{n.system}}</td>
                            <td><input class="form-control input-sm" type="number" name="input" ng-model="value"
                                       min="0" max="100" style="width:55px;">
                                </td>

                        </tr>
                        </tbody>
                    </table>
                    <button ng-click="postapi()">Value</button>

名称
系统
行动
{{n.name}
{{n.system}
价值
普朗克:


感谢您提前回复

您无法访问在ng repeat中定义的
值,因为ng repeat创建了自己的作用域。我知道的是不能从父作用域访问子作用域


如果将
ng model=“value”
更改为
ng model=“n.value”
,效果会更好。然后可以访问对象上的值

为什么要将数据中的所有元素绑定到
而不是将每个元素绑定到它自己的值,如
ng model=“n.value”
而不是
ng model=“value”
?使用您的方法,您将对
数据中的所有项目具有相同的值