What to use exactly to navigate data between views/controllers


#1

This is a very interesting question about the awesome ionic framework. I’m new to both ionic framework and angluar js.

I’ve started developing a simple application :

in the first view I’m retreiving all the games, and the other view i’m retreivig the game details according to the game id.

I didn’t link the two pages yet.

this is what i’m facing as problem. i’m confused ! should I use ion-view ?? or I should use a normal page

for each view I have a controller which look almost like :

.controller('tomorrowmatches', function($scope, $http) {
    $http.get("http://www.myappbackend/ofc/matches?date=2015-05-03")
        .success(function (response) {
            $scope.matches = response;

            }

        });

})

and how to pass data from conroller to another, in my example I wanna pass the game.id as shwon on the screenshot.

if you need more details just let me know. I just need someone to make things clear for me, and if there is an example it would be fantastic.


#2

Check out UI Router’s stateParams: https://github.com/angular-ui/ui-router/wiki/URL-Routing#url-parameters