-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(lib): improved the ngx-mailto.service.ts
- Loading branch information
1 parent
ea0e634
commit e692d91
Showing
4 changed files
with
69 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
|
||
import { NgModule } from '@angular/core'; | ||
import { NgxMailtoPipe } from './ngx-mailto.pipe'; | ||
|
||
|
||
@NgModule({ | ||
declarations: [], | ||
declarations: [NgxMailtoPipe], | ||
exports: [ | ||
NgxMailtoPipe | ||
], | ||
imports: [ | ||
CommonModule | ||
] | ||
}) | ||
export class NgxMailtoModule { } | ||
export class NgxMailtoModule { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { NgxMailtoPipe } from './ngx-mailto.pipe'; | ||
|
||
describe('NgxMailtoPipe', () => { | ||
it('create an instance', () => { | ||
const pipe = new NgxMailtoPipe(); | ||
expect(pipe).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import { Mailto } from './mailto'; | ||
import { NgxMailtoService } from './ngx-mailto.service'; | ||
|
||
@Pipe({ | ||
name: 'mailto' | ||
}) | ||
export class NgxMailtoPipe implements PipeTransform { | ||
|
||
constructor(private ngxMailtoService: NgxMailtoService) { | ||
} | ||
|
||
transform(value: Mailto): string | void { | ||
console.log('transform', value); | ||
return this.ngxMailtoService.compose(value); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters