
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
angular-content-editable
Advanced tools
angular directive for modify in real time any html tag you want
Download the package using npm:
npm install angular-content-editable
Download the package using bower:
bower install angular-content-editable
or directly from github.
Add the script to your page dependencies:
<script type="text/javascript" src="angular-content-editable.min.js"></script>
And finally add content-editable to your module dependencies:
angular.module('app', ['angular-content-editable'])
and you are ready to go, add the directive to any element you want:
<a href="#!" ng-model="myModel" content-editable>edit my text</a>
Note that, edit-callback has two arguments, that you must specify in your template to use them:
<div ng-model="myModel" edit-callback="myFunc(text, elem)" content-editable>
Some content
</div>
You can use the contentEditableProvider to set the default settings for the directive, but you can always pass directly to the directive as attributes to override the defaults for that element.
angular.module('app')
.config(function(contentEditableProvider) {
contentEditableProvider.configure({
singleLine: true // single line for all elements
})
})
Simply adding the directive makes the element fully editable.
<h2 ng-model="myModel" content-editable>Change me if you like.</h2>
With single-line attribute, when enter key is pressed the editing will finish (no line-breaks):
<div single-line="true" ng-model="myModel" content-editable>Change me anyway.</div>
With focus-select all text content will be selected on element click or focus.
<span focus-select="true" ng-model="myModel" content-editable>Change me!</span>
If you want to run a callback you must use edit-callback attribute with a valid function and it will run every time the model value is changed.
Since version 1.2.0, after issue #13 you MUST specify the arguments text, elem if you want to use them in your callback, like in this example.
<span focus-select="true" edit-callback="myFunc(text, elem)" ng-model="myModel" content-editable>Change me!</span>
angular.module('myApp')
.controller(function($scope) {
$scope.myFunc = function(text, elem) {
// do something magic
}
})
This gives the ability to pass additional arguments to the callback, because is executed with the parent scope.
If you want to fork you copy of the project and modify it:
npm install angular-content-editable // install module files
npm install // install dependencies
Than a Gruntfile is ready with this actions:
grunt // watch to /src folder and rebuild the package
grunt build // build the package for distribution
git checkout -b my-new-feature)npm install)git commit -am 'Add some feature')npm test)grunt build)git push origin my-new-feature)FAQs
modify in real time any html tag you want
The npm package angular-content-editable receives a total of 611 weekly downloads. As such, angular-content-editable popularity was classified as not popular.
We found that angular-content-editable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.