我想要默认值+输入值(用户输入)。我应该如何给出默认值?

发布于 2025-01-28 08:32:24 字数 733 浏览 4 评论 0 原文

TS文件

服务(已声明变量)

如果(请求=='Service帐户'){

   this.service = "SVC_" + NgModel
}

html文件,

<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>
                

我想要的输出是当用户输入用户ID时,SVC应默认情况下,而任何用户类型假设1234则应显示为SVC_1234。

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雨的味道风的声音 2025-02-04 08:32:24

您可以使用此软件包
访问: https://jsdaddy.github.io/ngx-mask-page/ngx-mask-page/main

npm install --save ngx-mask

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

npm install --save ngx-mask
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文