I'm new to angular and I'm creating a simple app. It navigates between projects, pulled in via JSON:
http://plnkr.co/edit/FTfa1rcVaf85xTu65oSR?p=preview
I am also using a factory, where I make a call such as get
or getOne
, so that it deals with the $http
in one place, only calling it if the data hasn't already been fetched.
This all works fine when you start on the home page, but when you start on an individual project page, both get
and getOne
are called at the same time, pulling in duplicate data. You can test this by opening the Plunker in it's own window and going to a url such as /#/projects/1
.
I know why this is happening, I just can't figure out how to stop it.
Is there a simple fix for this or am I going about it the completely wrong way?
Thanks for taking a look.