Skip to content

dzonatan/ngx-linky

Folders and files

NameName
Last commit message
Last commit date

Latest commit

82bf8e0 · Nov 22, 2021

History

83 Commits
Dec 17, 2020
Nov 22, 2021
Nov 22, 2021
Sep 26, 2018
Sep 26, 2018
Sep 26, 2018
Jun 7, 2021
Nov 22, 2021
Nov 22, 2021
Nov 22, 2021
Dec 7, 2020
Dec 7, 2020
Dec 7, 2020

Repository files navigation

ngx-linky

CI npm version

Angular pipe to find links in text input and turn them into html links. It was called the same "linky" in ngSanitize module of AngularJs (first). Since Angular does not have such pipe built in therefore this repo was created.

This is just a wrapper for Autolinker.js so all issues and feature requests related to autolinker should go to their issues!

Installation

npm install --save ngx-linky autolinker

Import LinkyModule or manually declare LinkyPipe in your app module.

import { LinkyModule } from 'ngx-linky';

@NgModule({
  imports: [
    LinkyModule
  ]
})
class YourAppModule {}

Usage

Use linky pipe with [innerHTML] (or outerHTML, depends on you) binding to get HTML correctly rendered:

<span [innerHTML]="yourText | linky"></span>

You can pass any autolinker option as a second pipe argument. For ex.:

<span [innerHTML]="myText | linky:{newWindow: false}"></span>

License

MIT