diff --git a/src/module/ngx-linkifyjs.module.ts b/src/module/ngx-linkifyjs.module.ts index 34f1c835..218d1957 100644 --- a/src/module/ngx-linkifyjs.module.ts +++ b/src/module/ngx-linkifyjs.module.ts @@ -1,5 +1,11 @@ import {CommonModule} from '@angular/common'; -import {NgModule, ModuleWithProviders} from '@angular/core'; +import {ModuleWithProviders, NgModule} from '@angular/core'; +// @ts-ignore +import * as linkify from 'linkifyjs'; +// @ts-ignore +import * as hashtag from 'linkifyjs/plugins/hashtag'; +// @ts-ignore +import * as mention from 'linkifyjs/plugins/mention'; import {NgxLinkifyjsService} from './service/ngx-linkifyjs.service'; import {NgxLinkifyjsPipe} from './pipes/ngx-linkifyjs.pipe'; @@ -19,6 +25,10 @@ export {NgxLinkifyjsService} from './service/ngx-linkifyjs.service'; }) export class NgxLinkifyjsModule { static forRoot(): ModuleWithProviders { + + hashtag(linkify); + mention(linkify); + return { ngModule: NgxLinkifyjsModule, providers: [NgxLinkifyjsService] diff --git a/src/module/service/ngx-linkifyjs.service.spec.ts b/src/module/service/ngx-linkifyjs.service.spec.ts index 376ad80d..c50325d4 100644 --- a/src/module/service/ngx-linkifyjs.service.spec.ts +++ b/src/module/service/ngx-linkifyjs.service.spec.ts @@ -1,9 +1,19 @@ import {inject, TestBed} from '@angular/core/testing'; +// @ts-ignore +import * as linkify from 'linkifyjs'; +// @ts-ignore +import * as hashtag from 'linkifyjs/plugins/hashtag'; + import {NgxLinkifyjsService} from './ngx-linkifyjs.service'; import {Link, LinkType} from '../..'; describe('LibService', () => { + + beforeAll(() => { + hashtag(linkify); + }); + beforeEach(() => { TestBed.configureTestingModule({ providers: [NgxLinkifyjsService]