2.0.0 • Published 5 years ago

ng-string-rotate v2.0.0

Weekly downloads
20
License
-
Repository
-
Last release
5 years ago

String rotater

String rotater for Angular; Rotate the string in clockwise/ anti-clockwise

  • john -> ohnj
  • john -> hnjo
  • jacob -> bjaco (anti-clockwise)

Installation

npm install --save ng-string-rotate

Usage

Import StringRotateModule

You need to import the StringRotateModule in the module of your app where you want to use it.

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { StringRotateModule } from 'ng-string-rotate';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    StringRotateModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Use the ng-string-rotate selector

Place the ng-string-rotate and pass the string as an input to ngString and also the number of times need to rotate as shifts

<ng-string-rotate [ngString]="'john'" [shifts]="2"></ng-string-rotate>

For anti-clockwise pass the rotate input as 'reverse'

<ng-string-rotate [ngString]="'jacob'" [rotate]="'reverse'"></ng-string-rotate>