I'm new to AngularJS and am trying to build myself a simple little app. I have JSON data for the app being fetched with $resource
, and this data should be the same across multiple views/routes. However, when I go to a new route, the JSON data (stored as $scope.data
) is no longer available to the new view. What can I do to pass this data to the new view and not require another fetch? (The tutorial phone-catalog app re-fetches this data every time from what I can tell.)
From what I understand, $rootScope
can do this but it seems to be generally frowned upon. I apologize if this doesn't make much sense; I'm very much diving in the deep end here.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…