UI.Ace

This directive allows you to add ACE editor elements.

Code on Github Download (0.2.3)

1
Ace here
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  1. <section>
  2. <div ui-ace >Ace here</div>
  3. </section>
  1. .ace_editor {
  2. height : 200px;
  3. }
# Theme and mode
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  1. <section>
  2. <div ui-ace="{
  3. useWrapMode : true,
  4. showGutter: false,
  5. theme:'twilight',
  6. mode: 'markdown'
  7. }" ># Theme and mode
  8.  
  9. *Lorem ipsum* dolor sit amet, consectetur adipisicing elit, sed do eiusmod
  10. tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
  11. quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
  12. consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
  13. cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
  14. proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
  15.  
  16. </section>
  1. .ace_editor {
  2. height : 200px;
  3. }
1
2
;; Scheme code in here.
(define (double x)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Mode :

  1. <section ng-controller="AceCtrl">
  2.  
  3. <div ui-ace="aceOption" ng-model="aceModel"></div>
  4.  
  5. <select ng-model="mode" ng-options="m for m in modes" ng-change="modeChanged()"></select>
  6.  
  7. </section>
  1. function AceCtrl($scope) {
  2. // The modes
  3. $scope.modes = ['Scheme', 'XML', 'Javascript'];
  4. $scope.mode = $scope.modes[0];
  5.  
  6.  
  7. // The ui-ace option
  8. $scope.aceOption = {
  9. mode: $scope.mode.toLowerCase(),
  10. onLoad: function (_ace) {
  11.  
  12. // HACK to have the ace instance in the scope...
  13. $scope.modeChanged = function () {
  14. _ace.getSession().setMode("ace/mode/" + $scope.mode.toLowerCase());
  15. };
  16.  
  17. }
  18. };
  19.  
  20. // Initial code content...
  21. $scope.aceModel = ';; Scheme code in here.\n' +
  22. '(define (double x)\n\t(* x x))\n\n\n' +
  23. '<!-- XML code in here. -->\n' +
  24. '<root>\n\t<foo>\n\t</foo>\n\t<bar/>\n</root>\n\n\n' +
  25. '// Javascript code in here.\n' +
  26. 'function foo(msg) {\n\tvar r = Math.random();\n\treturn "" + r + " : " + msg;\n}';
  27.  
  28. }
  1. .ace_editor {
  2. height : 300px;
  3. }