title: Angular JS routing control with dynamic parameter passing
body: <p>I'm new to AgularJs, and I'm working on a single page application. I was stuck on a position where i need to send an dynamic id to next template (i.e /pagename&amp;id= ) and that needs to be control using ng routing as well. Is there a way to handle routing url with this dynamic id value?</p>
  
  <p>This is the code snippets that matters</p>
  
  <pre><code>//Controller function call here passing the dynami id on 'data-value'
  &lt;button type="submit" data-value="&lt;dynami id&gt;" ng-click="submit();"&gt;
  
  //controller function
  var app = angular.module('myApp', []);
  var id = &lt;Dynamic id&gt;;
  app.controller('galleryController', function($scope, $http, $location) {
      $scope.submit = function() {
          $location.path('/gallary-single&amp;id='+id);
      }
  });
  
  //Routing...
  app.config(function($routeProvider) {
          $routeProvider
          .when('/', {
              templateUrl : 'pages/home.html',
              controller  : 'mainController'
          })
          .when('/gallary', {
              templateUrl : 'pages/gallary.html',
              controller  : 'galleryController'
          })
          .when('/gallary-single', {
              templateUrl : 'pages/gallary-single.html',
              controller  : 'gallerySingleController'
          });
      });
  </code></pre>