From a34a5bfa915c3dd418d0acf6459ff1bd88268cff Mon Sep 17 00:00:00 2001 From: mogudy Date: Tue, 13 Sep 2016 00:06:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dmodel=E5=8F=98=E5=8C=96?= =?UTF-8?q?=E5=90=8E=E7=BC=96=E8=BE=91=E5=99=A8=E5=86=85=E5=AE=B9=E4=B8=8D?= =?UTF-8?q?=E5=8F=98=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/angular-kindeditor.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/angular-kindeditor.js b/src/angular-kindeditor.js index ce9aee0..7a87929 100644 --- a/src/angular-kindeditor.js +++ b/src/angular-kindeditor.js @@ -45,7 +45,7 @@ editor.html(_content); }) - // ƥ + // 匹配正则 var regObj = scope.pattern ? new RegExp(scope.pattern) : false; if (regObj) { ctrl.$parsers.push(function (value) { @@ -58,6 +58,10 @@ }) } + scope.$watch('data', function(value) { + if (value) + editor.html(value); + }); }; return { @@ -65,7 +69,8 @@ require: '^ngModel', scope: { config: '=', - pattern: '=' + pattern: '=', + data: "=ngModel" }, link: linkFn };