greencatsoft / scalajs-angular

AngularJS Binding for Scala.js
Apache License 2.0
252 stars 42 forks source link

Typesafe injector #79

Closed svenwiegand closed 8 years ago

svenwiegand commented 8 years ago

Currently the result of Injector.get() requires explicit typing using asInstanceOf[]. Further on currently injection is only supported by identifier which might fail at runtime.

This pull request allows me to write Injector.get[RootScope] instead providing type safety and omitting manual specification of the identifier.

The injector isn't of much use in production code, but this change makes writing unit tests much more fun.

mysticfall commented 8 years ago

I tried to keep all macro implementations under internal package, so as not to confuse people with internal API methods. Probably we could apply the same convention to this case as well?

Please let me know how you think about it. Thanks!

svenwiegand commented 8 years ago

Makes sense. I'll change my pull request.

mysticfall commented 8 years ago

Looks good to me. Thanks for the update!