In my Main Web page, i have 2 different images.What i want to do is when i click on any of link images, it must load the same template but each link has different data to show on that template.On clicking the images it shows the template but how to insert different data for each link image.How should i do that as a beginner
app.js
app.config(function ($routeProvider) {
$routeProvider
.when('/inneralbum/:id', {
templateUrl: 'inneralbum.html',
controller:'MainCtrl'
})
MainCtrl.js
app.controller('MainCtrl', ['$scope', '$params', function ($scope, $params) {
$scope.id = $params.id;
}]);
Basically, you have 2 options:
Using query parameters with your image id as query param Either you use the ui-router funtionality or you use angular's location service.
Using child-routes with one route for each image Please check the ui-router docs on nested routes for that
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments