angularjs - Angular 2-way binding in ng-repeat -


i'm trying update values in ng-repeat ng-bind (or double curly braces) , html5's contenteditable.

i cannot double binding work. don;t think contenteditable issue since doesn't work either input fields.

<div ng-controller="myctrl">          <ul><li ng-repeat="sequence in sequences"  sv-element>             <span class="flex1" contenteditable="true" ng-bind="sequence.sequencetext"></span> //          <span  contenteditable="true">{{sequence.sequencetext}}</span>     </li></ul> {{sequences}} </div> 

http://jsfiddle.net/56g2jyd7/1/

well didn't want use directive did. nice , easy:

app.directive('contenteditable', function() {   return {     require: 'ngmodel',     link: function(scope, element, attrs, ctrl) {       // view -> model       element.bind('blur', function() {         scope.$apply(function() {           ctrl.$setviewvalue(element.html());         });       });        // model -> view       ctrl.$render = function() {         element.html(ctrl.$viewvalue);       };        // load init value dom      ctrl.$render();     }   }; }); 

http://plnkr.co/edit/tmx9kr8pdkas20vs2mkc?p=preview


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -