标签:
.directive("contenteditable", function(){ return { restrict: "A", require: "ngModel", link: function(scope, element, attrs, ngModel) { function read() { ngModel.$setViewValue(element.html()); } ngModel.$render = function() { element.html(ngModel.$viewValue || ""); }; element.bind(‘blur keyup change‘, function() { scope.$apply(read); }); } }; })
angular使directive让div contenteditable & ng-model生效
标签:
原文地址:http://my.oschina.net/imot/blog/482408