TypeScript is used heavily as we build up our application, but TypeScript isn’t required. If you want to Inject a Service without using TypeScript, you’ll need to understand the @Inject
decorator. The @Inject
decorator also allows you to provide any value or object that you need to share throughout your application without having to create a service.
Just a heads up, pretty sure this one should be after the next lesson! ;-)
Hi, is it ok that I had to use: import {Inject} from 'angular2/di'; instead of (as was told on the video): import {Inject} from 'angular2/angular2';
Do you use the colemak keyboard? I noticed you typed "arst" with is the colemak equivalent of asdf.
Yup, sure do. Nice eye :) I guess it would be pretty hard to roll arst on qwerty.
I noticed that you used the public key word, in the Angular docs they use the private. What is the difference between these? I.e Does private refer to the class only and if so does public refer to the application?
Which dependency injection is the preferred way: @Inject or loading the class in the app.components?
Hello John,
What is the added benefit of injecting the API string via the providers over exporting / importing it?
TSLint, that is provided with default settings highlights, that only public class members can be used in template.
Hi,
I was reading through Angular StyleGuide and came upon Style 07-04 on the topic of Services. It confused me.
Following the videos we are using the @Injectable
class decorator, but also using the @Inject
parameter to add our services to the constructor.
What's really going on with both solutions?