'I want default value + input value (which user enters). How should I give default value?

ts file

service(declared variable)

if (request == 'Service Account') {

   this.service = "SVC_" + NgModel
}

html file

<mat-form-field appearance="fill">
              <mat-label>User ID</mat-label>
              <input matInput type="text" name="userid" placeholder="UserID" ngModel
                           [disabled]="inputUserId" (keyup)="onKeyUp($event)" click="onSelect(item)">
            </mat-form-field>
                

The output I want is when user enters userId, SVC should come by default and whatever user type suppose 1234 then it should show as SVC_1234.

enter image description here



Solution 1:[1]

You can use this package visit : https://jsdaddy.github.io/ngx-mask-page/main

npm install --save ngx-mask

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1