Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/scottcorgan/angular-linkify
- Owner: scottcorgan
- License: mit
- Created: 2013-07-03T14:07:08.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2022-02-07T21:11:05.000Z (almost 3 years ago)
- Last Synced: 2024-12-06T01:03:25.709Z (17 days ago)
- Topics: angular, angular-2, linkify, linkify-text
- Language: JavaScript
- Homepage:
- Size: 27.3 KB
- Stars: 82
- Watchers: 4
- Forks: 29
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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";
// 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
```