Reputation: 3801
I have a readonly value that I want to access either statically or dynamically. I could write it this way:
class Example {
static readonly FOO = 1;
readonly FOO = 1;
}
The result would be:
const example = Example();
example.FOO === Example.FOO;
This approach seems very clumsy. Is there a way I can write this in one line?
Upvotes: 1
Views: 53
Reputation: 5782
In Angular, templates cannot access objects that are not exposed by a component. see https://github.com/angular/angular/issues/2885.
Something like this is required:
class Controller {
public example = Example;
...
}
Upvotes: 1