Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary line #1

Open
tylercollier-devmtn opened this issue Oct 14, 2017 · 0 comments
Open

Unnecessary line #1

tylercollier-devmtn opened this issue Oct 14, 2017 · 0 comments

Comments

@tylercollier-devmtn
Copy link

In Step 3, this line is not needed:

this.buyCar = function(id) {
  carsSrvc.buyCar(id);
  this.cars = carsSrvc.cars; // <====== this one
}

I don't know Angular well but I'd imagine this line might not be a great idea:

this.cars = carsSrvc.cars

(there are actually 2 of that line; it's the same idea for both). You've got a reference to the service's data. The service should probably expose a getter to get a copy of the data. I realize this is not a production app but probably worth starting good habits. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant