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 };