【问题标题】:UpperCase convert from Input Tag to a method in component大写从输入标签转换为组件中的方法
【发布时间】:2020-10-09 13:26:28
【问题描述】:

这段代码目前在

如何将这段代码放入组件中的方法中?

oninput="let p=this.selectionStart; this.value=this.value.toUpperCase(); this.setSelectionRange(p, p);"

【问题讨论】:

  • 我会咬... 将代码剪切并粘贴到定义函数的支持 .ts 代码文件中?然后更改上面的代码以调用该函数?我对吗? :|

标签: angular methods components uppercase


【解决方案1】:

首先你不应该在html中使用this.variableName,你应该写variableName。第二;

<ng-container *ngFor="let p = selectionStart"> .....(oninput)="functionName(p,p)" </ng-container>

如果您没有在此代码之外使用 ngFor 循环,并且 selectionStart 只是一个变量,您可以使用 functionName(selectionStart, selectionStart)

可能会做这项工作。

【讨论】:

    猜你喜欢
    • 2023-01-11
    • 2018-12-17
    • 2013-07-16
    • 1970-01-01
    • 2014-02-19
    • 2022-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多