UI.Ace

This directive allows you to add ACE editor elements.

Code on Github Download (0.2.3)

Ace here
<section>
  <div ui-ace >Ace here</div>
</section>
.ace_editor  {
  height : 200px;
}
  
# Theme and mode *Lorem ipsum* dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
<section>
    <div ui-ace="{
      useWrapMode : true,
      showGutter: false,
      theme:'twilight',
      mode: 'markdown'
    }" ># Theme and mode

*Lorem ipsum* dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>

</section>
.ace_editor  {
  height : 200px;
}
Ace here
Mode :

<section ng-controller="AceCtrl">

  <div ui-ace="aceOption" ng-model="aceModel"></div>

  <select ng-model="mode" ng-options="m for m in modes" ng-change="modeChanged()"></select>

</section>
function AceCtrl($scope) {
// The modes
  $scope.modes = ['Scheme', 'XML', 'Javascript'];
  $scope.mode = $scope.modes[0];


  // The ui-ace option
  $scope.aceOption = {
    mode: $scope.mode.toLowerCase(),
    onLoad: function (_ace) {

      // HACK to have the ace instance in the scope...
      $scope.modeChanged = function () {
        _ace.getSession().setMode("ace/mode/" + $scope.mode.toLowerCase());
      };

    }
  };

  // Initial code content...
  $scope.aceModel = ';; Scheme code in here.\n' +
    '(define (double x)\n\t(* x x))\n\n\n' +
    '<!-- XML code in here. -->\n' +
    '<root>\n\t<foo>\n\t</foo>\n\t<bar/>\n</root>\n\n\n' +
    '// Javascript code in here.\n' +
    'function foo(msg) {\n\tvar r = Math.random();\n\treturn "" + r + " : " + msg;\n}';

}
.ace_editor  {
  height : 300px;
}