Im Passing Selected Car Id in Url and trying to get data in console.log don't know where i'm missing may be i'm confused checking too much solution in stackoverflow - here is my code :
//Controller.js
$scope.chooseACar = function(selectCarId)
{
$scope.selectCarId = $stateParams.selectCarId;
console.log($scope.selectCarId);
}
//App.js
.state('main.step3',
{
url: '/step2/:selectCarId',
templateUrl: 'pages/step3.html'
});
//services.js
get: function(selectCarId) {
for (var i = 0; i < carListData.length; i++) {
if (carListData[i].id === parseInt(selectCarId)) {
console.log(carListData[i]);
return carListData[i];
}
}
return null;
}
// HTML Code
<a type="submit" href="#/main/step2/{{selectCarList.id}}" class="button button-yellow button-full submitBtn" style="color:#000; display:block">CHOOSE A CAR</a>
In App.js (if you are getting ID in url no need to modify.)
.state('main.step2', {
name: 'slectcarID'
url: '/step2/:selectCarId',
templateUrl: 'pages/step3.html'
});
and to get the data in controller use $stateParams
console.log($stateParams.selectCarId);
or
$scope.selectCarId = $stateParams.selectCarId;
console.log($scope.selectCarId);
Try either only ng-click or ui-sref