Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular2 how to access class constants in html

I have some constants defined as public static readonly in a typescript class. This contains some general constants which is across the application. How to access them in component html? is there a way directly to use in html? will something like {{MyConstantsFactory.Myconstant} work?

like image 226
Janier Avatar asked Oct 30 '17 23:10

Janier


1 Answers

No, you have to cast them locally (using your factory) in the class's constructor and use them as you would normally use any property

like image 159
Sonicd300 Avatar answered Sep 20 '22 03:09

Sonicd300



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!