remove-url-scheme
Removes scheme from URL, e.g. 'Http://'. Case insensitive
Author of regex expression: FailedDev
Install
$ npm install @helt/remove-url-scheme
Usage
- Register the
RemoveUrlSchemeModule
in your app module.
import { RemoveUrlSchemeModule } from '@helt/remove-url-scheme';
import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RemoveUrlSchemeModule } from '@helt/remove-url-scheme';
import { AppComponent } from './app.component';
@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
BrowserAnimationsModule,
...
HttpClientModule,
RemoveUrlSchemeModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
- Used through pipe operator in template or DI in component
<button mat-stroked-button>
<i class="material-icons">language</i>
{{'https://github.com' | removeUrlScheme}}
</button>
import { RemoveUrlSchemePipe } from '@helt/remove-url-scheme';
export class ExampleComponent implements OnInit {
newUrl!: string;
constructor(private removeUrlSchemePipe: RemoveUrlSchemePipe) {
this.newUrl = this.rus.tranform('https://github.com');
}
ngOnInit() {
}
}
https://github.com -> github.com
http://github.com -> github.com