December 2017
Beginner
372 pages
10h 32m
English
The property decorator is very similar to the class decorator, with the only change in the syntax is an additional parameter signifying the name of the decorated property. The following is a code snippet showing a property decorator:
function propertyDecorator(target: Object, propertyKey: string) { // add decorator logic}
As you can see, there are two parameters to a property decorator. The first parameter is the constructor of the class if the object is a static, else it will be the prototype of the class containing the property. The second parameter is a string, which defines the name of the property decorated in the class.
The use of the property decorator is similar to the class and method decorators; we just annotate ...
Read now
Unlock full access