amazon-archives / aws-cognito-angular-quickstart

An Angular(v5)-based QuickStart single-page app utilizing Amazon Cognito, S3, and DynamoDB (Serverless architecture)
https://cognito.budilov.com
Apache License 2.0
689 stars 300 forks source link

why is the UserLoginService used static #19

Closed mxab closed 8 years ago

mxab commented 8 years ago

Hi, I'm just browsing through the code but do not fully understand why the UserLoginService is used with static methods and importing it instead of injecting a instance via the constructor?

vbudilov commented 8 years ago

Hi @mxab ,

When I was writing this app, angular 2 was still in beta and a lot of things, including the IoC methodology, syntax & initialization, was in flux (breaking changes with almost every new version). I wanted to make sure that it would be easy to transition the code to a final state once Angular Final comes out.

In general, I'd definitely use injection now, rather the static classes.

Thanks, Vladimir

mxab commented 8 years ago

Hi @vbudilov, I understand, thanks for clarifying. I was not sure if I missed something.