3 ms·
Providers are really the only place where this is likely to happen. A FooProvider is an object that provides Foo to the dependency injector. So you tell Angular
by mcv 12y ago
Providers are really the only place where this is likely to happen. A FooProvider is an object that provides Foo to the dependency injector. So you tell Angular to provide Foo, and Angular creates the corresponding FooProvider for you. And what sets providers apart from services and factories, is that you can configure your FooProvider before the Foo gets injected, which is very useful, but you are suddenly talking to an object that you never created; Angular did.
By the way, Ruby on Rails does tons of this sort of thing, and goes a lot further. It automatically matches your Person class with the People table in your DB.