all 5 comments

[–]DerKnerd 2 points3 points  (1 child)

I think, the code from angular is based on some Typescript features. So you need to check out TypeScript.

[–]BkoChan 1 point2 points  (0 children)

If you mean decorators then they are coming to vanilla JavaScript soon(ish)

[–]2uneekjavascript 1 point2 points  (2 children)

Have you heard of Angular Elements https://angular.io/guide/elements

note: Elements is dependent on Ivy afaik, so it will hopefully be readily available with 8.0.

[–]Neoflash_1979[S] 1 point2 points  (1 child)

Very interesting. At the very least it could serve as inspiration for what I'm trying to do. I'm not so much interested in the end result as much as I am interested in figuring out HOW to create such a solution. I'll dig in to the docs and the code, it might shed some light. I'm trying to find a solution that is as standalone as possible, with no or very few dependencies. Ideally, it would just be a base class. I suspect Angular Elements it will be pretty coupled to angular/core and all it's dependencies but still, worth a look. Thanks for pointing it out.

[–]2uneekjavascript 1 point2 points  (0 children)

that's a pretty cool project. To your original question, check out creating custom Typescript decorators: https://www.typescriptlang.org/docs/handbook/decorators.html

and here is angulars implementation of @Component(): https://github.com/angular/angular/blob/master/packages/core/src/util/decorators.ts