代码之家  ›  专栏  ›  技术社区  ›  bafix2203

来自输入AngularJS的数字

  •  0
  • bafix2203  · 技术社区  · 8 年前

    $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>
    

    普朗克: http://plnkr.co/edit/g1t4pludTTIAJYKTToCK?p=preview

    感谢您提前回答!

    1 回复  |  直到 8 年前
        1
  •  1
  •   MrWook    8 年前

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

    ng-model="value" ng-model="n.value"