December 2017
Beginner
372 pages
10h 32m
English
The only difference between the parameter decorator and the property decorator is an additional third parameter. The parameter decorator is applied to the specific parameter in a function. To identify which parameter in a function is decorated, we use this third parameter. The following is the syntax of a parameter decorator in TypeScript:
function parameterDecorator(target: Object, propertyKey: string, index:number) { // add decorator logic}
The first two parameters are exactly the same as the property decorator, with the first parameter signifying the constructor of the class, and the second parameter being the name of the function to which the parameter belongs.
The third parameter, index, specifies the location of ...
Read now
Unlock full access