dart-archive / angular.dart

Legacy source repository. See github.com/dart-lang/angular
https://webdev.dartlang.org/angular/
1.25k stars 248 forks source link

Missing @NgInjectableService annotations #478

Closed bgourlie closed 10 years ago

bgourlie commented 10 years ago

I'm finding myself having to manually specify a bunch of angular stuff as injectable using the @Injectables annotation. I'm not sure if this is intentional as to keep the size of the generated static injector down, but I assume any difference in code size is negligible.

pavelgj commented 10 years ago

Could you give examples of angular services that are missing @NgInjectableService?

bgourlie commented 10 years ago

The following is what I'm having to manually include in order for my app to work with the generated static injector:

@Injectables(const [
    Profiler,
    StaticParser,
    DynamicParser,
    DynamicParserBackend,
    ClosureMap, 
    NgCloakDirective,
    NgViewDirective,
    NgADirective,
    NgEventDirective,
    NgModel,
    NgBindHtmlDirective,
    InputCheckboxDirective,
    NgShowDirective,
    NgForm,
    NgSourceDirective,
    NgModelRequiredValidator,
    InputTextLikeDirective,
    NgRepeatDirective,
    NgHideDirective,
    NgClassDirective,
    NgIfDirective,
    NgBooleanAttributeDirective,
    LowercaseFilter
])
pavelgj commented 10 years ago

It appears your di generator is misconfigured. See here: https://github.com/angular/angular.dart.tutorial/blob/master/Chapter_07/bin/generator.dart#L13

Also, Profiler is abstract class, it cannot be instantiated, so shouldn't be there.

bgourlie commented 10 years ago

Ahh, that makes sense.

Profiler is in-fact a concrete class (https://github.com/google/perf_api.dart/blob/master/lib/perf_api.dart), without including it in static injector:

Exception: Illegal argument(s): No type factory provided for Profiler! (resolving Compiler -> Profiler)

pavelgj commented 10 years ago

Right... my fault. Confused Profiler with Parser. Profiler for now belongs in the @Injectables...

jbdeboer commented 10 years ago

We have an effort to get the generators in tip-top shape; tagged this issue for 0.9.7

jbdeboer commented 10 years ago

480 landed, so I am assuming this issue is fixed.