Naming conventions for intercepting input property changes

Viewed 192

In the style guides it is advised to not prefix variables with underscored

But in this particular example I've seen it was used like this:

@Input() set testVariable(value) {
    this._testVariable= value;
}

When intercepting an Input, is there a naming convention for the class variable?

1 Answers

Using underscore as prefix it's OK for private variable if You have setter/getter. If You don't like it maybe better create method setTestVariable(value) instead of setter.

Related