1.0.0 • Published 5 years ago

ng-content-editable v1.0.0

Weekly downloads
142
License
MIT
Repository
github
Last release
5 years ago

ng-content-editable

This is a slightly extended fork of the npm package ng-content-editable.

Demo

You can tryout ng-content-editable here.

Getting Started

Download the package, and include the dist/ng-content-editable.min.js file in your page.

npm install ng-content-editable --save

Then add the content-editable module to your Angular App file, e.g.

var app = angular.module('app', ["content-editable"]);

Usage

<div contenteditable
     ng-model="model"
     ng-maxlength=255
     ng-minlength=3
     only-text="true"
     only-num="true"
     convert-new-lines="true"
     no-lf="true"
     no-trim="true"
></div>

Description of optional attributes

AttributeDescriptionExample
ng-maxlengthThe max-length for the attribute255
ng-minlengthThe min-length for the attribute3
only-textRemove all the html tags for the attribute valuetrue or false
convert-new-linesConvert all <br>, <p> and <div> to \r\ntrue or false
only-numAllow numbers 0-9, . and , onlytrue or false
no-lfLine breaks not allowed, results in single linetrue or false
no-trimDisable default trim (removes whitespace from both ends of a string)true or false

Contributing

It's easy for you to make a contribution, just open a PR on GitHub :)

But if this will be your first contribution to a JavaScript project, below are some steps that are useful during development.

Install the dev dependencies:

npm install

Generate the dist files:

npm run build