ngroute pass different data for different id in angular js

Ankur Chauhan

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;
}]);
schacki

Basically, you have 2 options:

  1. Using query parameters with your image id as query param Either you use the ui-router funtionality or you use angular's location service.

  2. 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.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Creating duplicated data frames with different ID

From Dev

Dependency Problems Angular.js ngRoute ngSanitize

From Dev

Manipulate multiple divs with different id using Angular

From Dev

Store decoded data in to different ID

From Dev

Core Data Different Object ID For First Time

From Dev

How to pass data to different page using AngularJS?

From Dev

elasticsearch allows duplicate ID with different body data

From Dev

ngroute pass different data for different id in angular js

From Dev

Vue.js pass $store data from different modules

From Dev

React - How can I pass API data from one component to another in a different js file?

From Dev

How to get row id and pass to checkbox in same row but different column in react js?

From Dev

How to pass an id to a different view

From Dev

Get a data from a different table using id

From Dev

Pass data from different controllers to one view

From Dev

Different way to pass untrusted data into a Javascript script?

From Dev

Manipulate multiple divs with different id using Angular

From Dev

Why Angular.js different version has different structure?

From Dev

how to pass data intent in different textview in android

From Dev

Store decoded data in to different ID

From Dev

unwind segue pass data to different viewcontrollers

From Dev

How to pass data to different page using AngularJS?

From Dev

elasticsearch allows duplicate ID with different body data

From Dev

How to pass data between different modules using service having two different controller with different modules?

From Dev

Angular JS not redirecting to a new template (ngRoute)

From Dev

Concatenating different data with the same ID

From Dev

Pass data to different controllers using Angularjs

From Dev

average data according to the ID distribution of different columns

From Dev

Pass existing data to different view

From Dev

Passing different data to component in Angular

Related Related

  1. 1

    Creating duplicated data frames with different ID

  2. 2

    Dependency Problems Angular.js ngRoute ngSanitize

  3. 3

    Manipulate multiple divs with different id using Angular

  4. 4

    Store decoded data in to different ID

  5. 5

    Core Data Different Object ID For First Time

  6. 6

    How to pass data to different page using AngularJS?

  7. 7

    elasticsearch allows duplicate ID with different body data

  8. 8

    ngroute pass different data for different id in angular js

  9. 9

    Vue.js pass $store data from different modules

  10. 10

    React - How can I pass API data from one component to another in a different js file?

  11. 11

    How to get row id and pass to checkbox in same row but different column in react js?

  12. 12

    How to pass an id to a different view

  13. 13

    Get a data from a different table using id

  14. 14

    Pass data from different controllers to one view

  15. 15

    Different way to pass untrusted data into a Javascript script?

  16. 16

    Manipulate multiple divs with different id using Angular

  17. 17

    Why Angular.js different version has different structure?

  18. 18

    how to pass data intent in different textview in android

  19. 19

    Store decoded data in to different ID

  20. 20

    unwind segue pass data to different viewcontrollers

  21. 21

    How to pass data to different page using AngularJS?

  22. 22

    elasticsearch allows duplicate ID with different body data

  23. 23

    How to pass data between different modules using service having two different controller with different modules?

  24. 24

    Angular JS not redirecting to a new template (ngRoute)

  25. 25

    Concatenating different data with the same ID

  26. 26

    Pass data to different controllers using Angularjs

  27. 27

    average data according to the ID distribution of different columns

  28. 28

    Pass existing data to different view

  29. 29

    Passing different data to component in Angular

HotTag

Archive