Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ace-angular

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ace-angular - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

41

ace-angular.js
'use strict';
/**
* Module
* Module ace.angular
*
* Description
* Description to use Ace Editor in angular JS
*/

@@ -21,5 +21,42 @@ angular.module('ace.angular',[])

var options = scope.$eval(attrs.aceEditor) || {};
if(options.mode){
session.setMode("ace/mode/"+options.mode);
}
if(options.require){
for(var i in options.require){
window.ace.require(options.require[i]);
}
}
if (options.theme) {
editor.setTheme("ace/theme/"+options.theme);
}
if (options.advanced) {
editor.setOptions(options.advanced);
}
if(options.onLoad){
options.onLoad(editor, session, window.ace);
}
elm.on('$destroy', function () {
editor.session.$stopWorker();
editor.destroy();
});
scope.$watch(function() {
return [elm[0].offsetWidth, elm[0].offsetHeight];
}, function() {
editor.resize();
editor.renderer.updateFull();
}, true);
session.on("change", function(e){
ngModel.$setViewValue(session.getValue());
});
}

@@ -26,0 +63,0 @@ }

@@ -7,2 +7,17 @@ var app = angular.module('app_test',['ace.angular']);

}
$scope.aceOptions = {
mode: 'sql',
theme:'sqlserver',
require: ["ace/ext/language_tools"],
advanced:{
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: false,
autoScrollEditorIntoView: true,
},
onLoad: function(editor, session, ace){
$scope.langTools = ace.require("ace/ext/language_tools");
}
}
}])

2

package.json
{
"name": "ace-angular",
"version": "0.0.1",
"version": "0.1.0",
"description": "Module to use ace editor in angular js",

@@ -5,0 +5,0 @@ "main": "ace-angular.js",

# ace-angular
Using Ace Editor in AngularJS
## Requeriments
- AngularJS: npm install angular
- Ace Builds: npm install ace-builds
## Install
```
npm install ace-angular
```
## Usage
```html
<!-- Load Angular -->
<script src="node_modules/angular/angular.js"></script>
<!-- load ace -->
<script src="node_modules/ace-builds/src-min/ace.js"></script>
<!-- load ace language tools -->
<script src="node_modules/ace-builds/src-min/ext-language_tools.js"></script>
<!-- load ace-angular -->
<script src="node_modules/ace-angular/ace-angular.js"></script>
```
Create angular module
```js
var app = angular.module('myapp',['ace.angular']);
```
Using directive
```html
<div ace-editor="aceOptions" ng-model="aceContent"></div>
```
Controller
```js
$scope.aceOptions = {
method: 'sql',
theme: 'sqlserver',
onLoad: function(editor, session, ace){
// do anythig
}
}
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc