Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why create component with annotation? #83

Open
AIMMOTH opened this issue Jan 27, 2016 · 1 comment
Open

Why create component with annotation? #83

AIMMOTH opened this issue Jan 27, 2016 · 1 comment

Comments

@AIMMOTH
Copy link

AIMMOTH commented Jan 27, 2016

Why is directive created with Scala class and component with an annotation?

@jokade
Copy link
Owner

jokade commented Jan 28, 2016

Why is directive created with Scala class and component with an annotation?

This annotation was an experiment to support the angular2 concept of components with Angular 1.3 (which had no .component()). Hence, if we want to use a single Scala class as a component, we need to create a directive definition object and a controller constructor function from it.

This could be accomplished at runtime (eg. by writing our own version of .component(), although the missing support for static class members in Scala.js probably complicates this approach). Or we can derive a directive object + a controller class at compile time. The latter approach was taken in angulate, and the only way (afaik) to create a derived object + class from a given input class at compile time in Scala are macro annotations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants