Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/scottcorgan/angular-linkify

Angular filter, directive, and service to linkify text.
https://github.com/scottcorgan/angular-linkify

angular angular-2 linkify linkify-text

Last synced: 4 days ago
JSON representation

Angular filter, directive, and service to linkify text.

Awesome Lists containing this project

README

        

# angular-linkify

Angular filter, directive, and service to linkify text. As of **v0.3.0**, angular-linkify works for twitter/github mentions, twitter hashtags, and basic urls.

## Install

Install via either [bower](http://bower.io/), [npm](https://www.npmjs.com/), CDN (jsDelivr) or downloaded files:

* `bower install angular-linkify --save`
* `npm install angular-linkify --save`
* use [CDN file](https://www.jsdelivr.com/projects/angular.linkify)
* download [angular-linkify.zip](https://github.com/scottcorgan/angular-linkify/zipball/master)

Include `angular-linkify.min.js` in your angular application

```html

```

## Usage

Inject module into your application

```javascript
angular.module('YourApp', ['linkify']);
```

Use as a [AngularJS Directive](http://docs.angularjs.org/guide/directive)

```html


```

Inject as a [AngularJS Service](http://docs.angularjs.org/guide/dev_guide.services)

```javascript
// Injected into controller
angular.module('someModule').controller('SomeCtrl', function ($scope, linkify, $sce) {
var text = "@scottcorgan and http://github.com";

// Twitter
// Must use $sce.trustAsHtml() as of Angular 1.2.x
$scope.text = $sce.trustAsHtml(linkify.twitter(text));
// outputs: scottcorgan and http://github.com

// Github
// Must use $sce.trustAsHtml() as of Angular 1.2.x
$scope.text = $sce.trustAsHtml(linkify.github(text));
// outputs: scottcorgan and http://github.com

});

```

## Build

```
grunt
```