AngularJS format array values in textarea

前端 未结 3 727
忘了有多久
忘了有多久 2021-01-02 08:28

I have a angularJS application, in which I have an array.

  $scope.data[0] =  x1;
  $scope.data[1] =  x2;

and a text area

         


        
3条回答
  •  长情又很酷
    2021-01-02 09:20

    This is exactly what ng-list does:

    
    

    This also works on all other kinds of inputs as it hooks into ngModels parsers/formatters.

    See this fiddle: http://jsfiddle.net/xbYzT/1/

    The problem with this is that ng-list always joins with a ',' as the separator, so it's not really bi-directional.

提交回复
热议问题