@@ -0,0 +1,8 @@
|
||||
import { RelativeUrlPipe } from './relative-url.pipe';
|
||||
|
||||
describe('RelativeUrlPipe', () => {
|
||||
it('create an instance', () => {
|
||||
const pipe = new RelativeUrlPipe();
|
||||
expect(pipe).toBeTruthy();
|
||||
});
|
||||
});
|
||||
17
frontend/src/app/pipes/relative-url/relative-url.pipe.ts
Normal file
17
frontend/src/app/pipes/relative-url/relative-url.pipe.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { StateService } from 'src/app/services/state.service';
|
||||
|
||||
@Pipe({
|
||||
name: 'relativeUrl'
|
||||
})
|
||||
export class RelativeUrlPipe implements PipeTransform {
|
||||
|
||||
constructor(
|
||||
private stateService: StateService,
|
||||
) { }
|
||||
|
||||
transform(value: string): string {
|
||||
return (this.stateService.network ? '/' + this.stateService.network : '') + value;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user