I'm working with Angular 12. I would like to know if it is possible to intercept a core method call such as createComponent()
from ViewContainerRef
under @angular/core
, to be able to do some AOP stuff.
Asked
Active
Viewed 140 times
1

Omar Fendri
- 119
- 1
- 6
-
did you try aspectjs? – Aakash Garg Mar 11 '22 at 14:24
-
No, I will take a look. Thanks. – Omar Fendri Mar 11 '22 at 14:28
-
basically proxy api is used for such stuff, as an example you can see here :- https://javascript.plainenglish.io/javascript-how-to-intercept-function-and-method-calls-b9fd6507ff02. – Aakash Garg Mar 11 '22 at 14:41
-
_Method Modification_ (function wrapping) is as far away from the concept of AOP as is referring to the usage of just functions as _Functional Programming_. [Altering closed functionality](https://stackoverflow.com/questions/24911700/is-there-a-way-to-inject-a-try-catch-inside-a-function/48499699#48499699) in JavaScript has nothing to do with _Aspect-oriented Programming_ unless an implementation that claims to be _AO_ provides **abstraction and code-reuse levels** for at least _**Aspect**_, _**Advice**_ and _**Pointcut**_. – Peter Seliger Aug 25 '22 at 12:26
1 Answers
0
I'm the creator of @aspectjs, a library I recently created to to AOP for node and browser. It cannot be used to enhance existing code from Angular, but you can enhance your own methods (or classes, parameters, properties) with a simple annotation. Moreover, it should play nice with Angular decorators; Please tell me if it can fit your needs.

Nicolas
- 1,566
- 1
- 10
- 8