angular.js - angularjs点击在下面绑定数据
世界只因有你
世界只因有你 2017-05-15 16:54:38
0
1
543

我现在用ng-reapeat动态添加了一个列表ul li,但是我想点击某个li,就把他的值附在下面的input中,然后我就可以修改,上面的数据就跟着变。
这是我在codepen上写的一小半代码地址 codepen地址

expanderModule.directive('items',function(){ var str='
  • {{p.todotext}}

    {{title}},

  • '; return { restrict : 'EA', replace : true, transclude : true, template : str, link : function(scope, element, attrs) { } } } }); expanderModule.controller('SomeController',function($scope) { $scope.currentItem=0; $scope.todos=[{id:'0',todotext:'第一个item',done:false}, ]; $scope.addd=function(){ $scope.currentItem++; $scope.todos.push({id:$scope.currentItem,todotext:'第'+$scope.currentItem+'个item',done:false}) }...

    html

    想显示点击的值,并且能编辑可以相互绑定

    世界只因有你
    世界只因有你

    reply all (1)
    淡淡烟草味

    You can set each of them to have an ngmodel attribute, and then when you click li in the controller, you can bind them to each other

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!