ui-ace icon indicating copy to clipboard operation
ui-ace copied to clipboard

setValue() doesn't work

Open sergomet opened this issue 9 years ago • 2 comments

editor:

        <div ng-model="html" ui-ace="{
          require: ['ace/ext/language_tools'],
          advanced: {
            enableEmmet:true,    
            enableSnippets: false,
          },
          useWrapMode : true,
          fontSize: '14px',
          splitMode : false,
          showGutter: true,
          theme:'monokai',
          mode: 'html',
          firstLineNumber: 5,
          onLoad: aceLoaded,
          onChange: bodyChanged
        }">

tried:

  $scope.aceLoaded = function(_editor) {
    var _session = _editor.getSession();
    _session.setValue('hello');  
  };

and:

  $scope.aceLoaded = function(_editor) {
    _editor.setValue('hello');  
  };

Expect this everything works nice, thanks!

sergomet avatar May 15 '16 18:05 sergomet

+1 facing the same issue

ashish-agrawal-metacube avatar May 04 '17 12:05 ashish-agrawal-metacube

Use ngModel for it.

$scope.aceLoaded = function($editor) {

    $scope.$editor = $editor;
};

$scope.onOpen = function(code, fileExtension) {
    let mode = resolveExtension(fileExtension);
    $scope.html = code;
    $scope.$editor.session.setMode('ace/mode/' + mode);
}

augustoeliezer avatar Oct 23 '17 10:10 augustoeliezer