angular-simple-format

Angular filter for applying simple html formatting to text.


Keywords
angular, formatting, new line, line break, br, linky, html escape
License
MIT
Install
bower install angular-simple-format

Documentation

Angular Simple Format

Angular filter for applying simple html formatting to text.

Formatting applied:

  • Appending linebreak (<br>) after newline(\n).
  • Converts urls to link tags
  • Escapes html tags

Example usage

app.controller('showPostCtrl', function($scope){
  $scope.text = "example:\n line 1\n line 2\n line 3\n http://example.com"
});
<p ng-bind-html='text|simpleFormat'>

Requirements

angular.js
angular-sanitize.js

Installation

Include lib/angular_simple_format.js into your page and then list simpleFormat as your module dependency.

window.app = angular.module('YourApp', ['simpleFormat'])

Running the tests

Install bower developer dependencies - bower install.

Just open - test/runner.html.

Contributing

Every fresh idea and contribution will be highly appreciated.

License

MIT License.