Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Angular directive for applying simple html formatting to text

License

Notifications You must be signed in to change notification settings

RStankov/angular-simple-format

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Angular directive for applying simple html formatting to text

Resources

License

Stars

Watchers

Forks

Packages

No packages published