角度:绑定到@Input别名 [英] Angular: Bind to an @Input alias

查看:65
本文介绍了角度:绑定到@Input别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在此程序正在运行,但是我收到TS Lint的警告

The program is working, but I'm receiving this warning from TS Lint

指令输入属性不应重命名

the directive input property should not be renamed

指令选择器是这个

@Directive({
  selector: '[appAvatarColor]'
})

我做错什么了吗?
为什么默认情况下会将此视为不良做法?

Am I doing something wrong?
Why is this considered a bad practice by default?

推荐答案

您可以在 tslint.json

"no-input-rename": false

或禁用仅检查特定行,例如:

or disable checking for only specific line like:

// tslint:disable-next-line:no-input-rename
@Input('appAvatarColor') name: string;

我的问题是,为什么默认情况下认为这是一种不好的做法?

My question is why is this considered a bad practice by default?

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆