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
angularjs:如何在ng repeat中使ng模型动态_Angularjs - Fatal编程技术网

angularjs:如何在ng repeat中使ng模型动态

angularjs:如何在ng repeat中使ng模型动态,angularjs,Angularjs,我正在使用blueimp jquery文件上传版本 <tr data-ng-repeat="file in queue" data-ng-class="{'processing': file.$processing()}"> <td data-ng-controller="MyController"> <p > <span ng-click="clickme()" ng

我正在使用blueimp jquery文件上传版本

 <tr data-ng-repeat="file in queue" data-ng-class="{'processing': file.$processing()}">
    <td data-ng-controller="MyController">                   
      <p >     
       <span  ng-click="clickme()" ng-show="edit==false" >{{file.name}} </span>                   
     <input type="text" class='form-control filenameinput'  value="{{file.name}}" ng-show="edit==true>
</p></td>
问题是file.name不是ng模型,所以若用户在span中未显示的文本框中进行更改

如何使{{file.name}}成为ng模型 可能吗?
任何帮助都将不胜感激

将文件声明为控制器中的对象,如$scope.file={};然后您可以向它添加属性。您还应该设置输入属性ng model='file.name',而不必指定我的第一条注释。那是脑放屁。嗯,怎么样?没用

{{file.name}

$scope.edit = false;

            $scope.clickme = function () {
                $scope.edit = true;
            }