Pass parameter from a view to another view


#1

Hi , Please any one help me
my first view is a list how display many product , when i click my choice my second view show me the details of this product, but i can’t pass the id of the product from the first view to the second in order to display the detail from the database.
there is my code :
First Page

Acceuil.html:

Second Page:
Livre.html:

My Controller :
(function(){
app=angular.module(‘starter’, [‘ionic’,‘youtube-embed’,‘ngCordova’])
app.config(function($stateProvider,$urlRouterProvider)
{

$stateProvider.state(“acceuil”,{
url:"/acceuil",
templateUrl:“templates/acceuil.html”,
controller:“acceuilCtrl”
});
$stateProvider.state(“Livre”,{
url:"/:name",
templateUrl:“templates/Livre.html”,
controller:“LivreCtrl”

});
app.controller(‘acceuilCtrl’, function($scope, $http) {
$http.get(“http://localhost/query.php”)
.success(function (response) {$scope.names = response.records;});
});
app.controller(‘LivreCtrl’, function($scope, $http) {

$http.get(“http://localhost/query.php”)
.success(function (response) {$scope.names = response.records;});
// $scope.item={name:“Coran”,price:“12:00”};
});

}());
.


#2

Hi I maybe not seeing this right. But I believe you have two controllers that had nothing to do with each other except one calls the Ng-href and moves to the selected view. Both controllers have same values passed to the Dom and nothing else.

And this, one of important thing about ionic. I wished I paid more attention to this until too late. Now I have complicated codes to handle this simple idea.

Or


#3

Thanks :slight_smile: