Hey guys,
I’ve got a quick question that had me going cross-eyed. I’m working on a little app with the side nav starter setup that displays a few peoples faces and a little blurb about them from a JSON file. That’s the first state. The second state will slide in once I touch a face and will display a larger photo and more detail about them based off of the ID that is assigned to them in the JSON file. Using an $http request I am able to see this info on the first state, but once I try to load in the second state and see more details, it doesn’t load the data from the data-binding, but it does show the right state. How can I pull this data into my second state so I can see what’s in the JSON file?
My current code is as follows:
controller:
.controller('PlaylistCtrl', ['$scope', '$routeParams', 'Video',
function($scope, $routeParams, Video) {
$scope.video = Video.get({
videoId: $routeParams.videoId},
function(video) {
$scope.image = video.videoUrl;
});
}])
Service:
app.factory('Video', ['$resource',
function($resource){
return $resource('videos/video:videoId.json', {}, {
query: {method:'GET', params:{videoId:'videos'}, isArray:true}
});
}]);
State:
.state('app.single', {
url: "/playlists/{videoId}",
views: {
// So this one is targeting the unnamed view within the parent state's template.
'menuContent': {
templateUrl: 'templates/playlist.html',
controller: ['$scope', '$stateParams', 'utils',
function ( $scope, $stateParams, utils) {
$scope.video = utils.findById($scope.videoes, $stateParams.videoId);
}]
}
}
});
I apologize for this being so long and probably impossible to solve without others being able to look at it all, but any help or tips I can get on this would be much appreciated. Thanks for your time and to the guys at ionic, thanks for a really awesome product!