0

I'm currently having some problems on the decorators. The decorators is not being called on each class instance. I am totally aware that decorators are being called during declaration time, however, is it possible to call it every instance of the class?

Yhan
  • 51
  • 5

1 Answers1

0

Decorators are called when the class is declared—not when an object is instantiated

By design typescript calls the decorators on class declaration and not when it is instantiated. So there is no way to call them on every instance of the class.

You can refer this answer for more info.

ellipsis
  • 12,049
  • 2
  • 17
  • 33
  • I see, so there's no way to handle this kind of approach. hmmm, thanks for your help! – Yhan Jan 31 '19 at 03:16