title: Passing variable through URL with angular js
body: <p>I am using angular to make an e-commerce, and I'm setting an infinite scroll to the products list page. Everything worked fine, but I want to use the URL to set the page, so the user can access an specific page through URL. how do I set a variable like "pageNumber" in the URL with angular? like "www.page.com/page/2/"(I want to get the number 2 and pass it to the store controller)</p>
  
  <p>Here's the code I have now</p>
  
  <pre><code>(function() {
  var app = angular.module('concurseirosUnidos', ['store-directives', 'ngRoute']);
      app.config(function($routeProvider, $locationProvider){
      $locationProvider.html5Mode(true);
      $routeProvider
      .when('/', {templateUrl: 'partials/products-list.html'})
      .when("/page/$pageNumber"), {
          // probably I'd need to put something here?
      })
       .otherwise({redirectTo:'/'});;
      }
  });
  
    app.controller('StoreController', ['$http', '$scope', function($http, $scope){
      var store = this;
      store.products = [];      
  
      $http.get('/app/products/products.json').success(function(data){
          store.products = data;
      });
  
      if(typeof page === 'undefined'){
          var page = 1;   
      }else{
        //if it's defined through the url, page = pageNumberFromURL
      }
      $scope.myLimit = 3 * page;
  
      $scope.nextPage = function () {
          page++; // I want this function to actually update the url and get the variable from there
          $scope.myLimit = 3 * page;
      };
  
    }]);
  
  })(); 
  </code></pre>