Reputation: 7620
let's say I have the following template
<div>{{myvalue.ID}}</div>
I can provide ID using
public ID: string;
or
get ID() {
return this._ID;
}
or even do something like
<div>{{myvalue.getID()}}</div>
readonly getID= (): string => this.ID;
which looks like a get actually.
My question is, compare to give a direct variable reference, are get and readonly function slowing angular ?
I have some variable I would like to display to the user, but keep them private cause I don't want anyone to modify them (in code and template). I believe there are no other way of doing so but, is it impacting performance ?
Upvotes: 0
Views: 43
Reputation: 1778
It is not good design to use functions for binding references.
Few reasons for this are:
Upvotes: 1