I have page1.html has a list of objects, when the user clicks on one object the website should navigate to other page and display the object details.
1.HTML Page ahs a table , each row is object:
<tr ng-repeat="abjcet in nc.object">
<td>{{object.title}}</td>
</tr>
2.when user clicks on the title the same object must be transferred to the next HTML page and I've try this and I the object is retrieved but I don't know how to store it and use it in the next HTML page:
<tr ng-repeat="object in nc.objects">
<td ng-click="getById(object.id)">{{object.title}}</td>
</tr>
my Controller:
(function () {
'user strict';
angular.module('app').controller('myController', myController);
myController.$inject = ['$http', '$scope' ];
function myController($http , $scope ) {
var nc = this;
nc.objects = [];
nc.object = null;
nc.getById = getById ;
init();
function init(){
getAll();
}
function getAll()
{
var url = "/getAll/";
var Request = $http.get(url);
Request.then(function (response) {
nc.objects = response.data;
});
}
function getById(id) {
var url = "/findById/"+id;
var Request = $http.get(url);
Request.then(function (response) {
nc.object = response.data;
});
}
}
})();