title: Resolve object from routing resolve to controller in angular
body: <p>I have routing config like following</p>
  
  <pre><code>var app = angular.module("productApp",["ngRoute"]);
  app.config(function($routeProvider){
      $routeProvider.when("/",
          {
              templateUrl : "views/home.html",
              controller :  "homeController"
          }).
          when("/add/:productId?",
          {
              templateUrl : "views/products/add.html",
              controller :  "productController",
              resolve : {
                  checkId: function($q,$timeout,$http,$route,$location){
                      var defer = $q.defer();
                      var productData = {};
                      var productId = $route.current.params.productId;
                      $http.get("model/checkProductById.php?productId="+productId).then(function(data){
                          if(data.data.status==1){
                              productData = data.data.data;
                              // console.log("afterthis");
                              // console.log(productData);
                              defer.resolve(productData);
                              return productData;
                          }else{
                              //defer.reject();
                              $location.path("/");
  
                          }
                      });
  
                      return defer.promise;
                  }
              }
          }).
          when("/products",
          {
              templateUrl:    "views/products/view.html",
              controller:     "productController"
          });
  });
  app.controller("homeController",function($scope){
      $scope.model = {
          message:"Hello World"
      };
  });
  </code></pre>
  
  <p>Check Id in resolve check if product id is valid via $http  service.I also checking and returning product object in resolve object.</p>
  
  <p>My controller :</p>
  
  <pre><code>app.controller("productController",function($scope, $http,productService,$routeParams,checkId){
  
      $scope.productId = $routeParams.productId;
      $scope.model = {
          message:"Hello World from products"
      };
  }));
  </code></pre>
  
  <p>When i pass checkId in controller it giving error of unknown provider.
  How can i get resolve object in controller.</p>
  
  <p>Thanks</p>