Question

After having used AngularJS for some time I now found the Dart language and AngularDart which both look promising. However, my main concern is that AngularJS has a lot of awesome modules and I haven't found any resources, whether you are able to use those in AngularDart. Is it possible to inject services written in AngularJS into AngularDart controllers? Of course, they are untyped, but it's not a problem for me, the functionality is what matters the most.

Do you have any solutions(even if it involves some hack) for this?

Was it helpful?

Solution

AngularJS controllers are NOT compatible with AngularDart.

I haven't tried but what could possibly work is that AngularDart and AngularJS work in the same application when they each have their own root element (ng-app) and one root is not a child of the other.

You can use Dart-js-interop to call JavaScript functions. But your service can not be used with dependency injection. You could build a Dart wrapper that does the Dart-js-interop and register the wrapper in DI.

I would expect it to get complicated when the JS service itself needs DI (or any other functionality from AngularJS) for its initialization or processing. I don't know AngularJS or RestAngular but I would rather consider porting RestAngular to Dart.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top