Skip to content

Commit

Permalink
修复编辑器初始化时的错误
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostboyzone committed May 31, 2015
1 parent e98a9d3 commit d49ab84
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-simditor",
"version": "0.0.2",
"version": "0.0.3",
"homepage": "https://github.com/ghostboyzone/angular-simditor",
"authors": [
"ghostboyzone <ghostboyzone@gmail.com>"
Expand Down
8 changes: 7 additions & 1 deletion src/angular-simditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@
var editor = new Simditor(
angular.extend({textarea: iElm}, simditorConfig)
);
editor.setValue($scope.content);

$scope.$watch('content', function(value){
if(typeof value !== 'undefined'){
editor.setValue($scope.content);
}
});

editor.on('valuechanged blur focus', function(e){
if($scope.content != editor.getValue()){
$scope.$apply(function(){
Expand Down

0 comments on commit d49ab84

Please sign in to comment.