I\'m wondering if there is any benefit to do this:
{{getSomething()}}
export class MyComp {
getSomething() { return ...}
}
The difference is in the first case you use a function in expression, but in the second case it's not a function. So you can't use
{{getSomething()}}
export class MyComp {
get getSomething() { return ...}
}
The benefits of using second method is to use encapsulation of the property inside the class and you need to access it outside the class.
Getters and setters are part of ES5 spec. You can read about getter and setter.