title: StateParams passed through function not working using meteor
body: <p>Here is my function used to retrieve data from the database depending on the parameter <code>idCats</code>:</p>
  
  <pre><code>  this.getSubcat = function(){
  
      //Load products on scroll.
      this.subscribe('SubcatIndex', () =&gt; [ $stateParams.idCats, self.loaded ], {
        onReady: function() {
  
          Meteor.call('allSubcats', $stateParams.idCats, function(err, count) {
              self.allsubcats = count;
              self.limit = self.loaded;
              console.log("Test Log: " + $stateParams.idCats);
  
            self.subcats = Products.find({
              catLinkID : $stateParams.idCats
            },{
                fields: {
                  _id: true,
                  name: true,
                  catLinkID: true,
                  idCat: true,
                  image: true,
                  listingsCount: true,
                  productOffersCount: true,
                  productSoldCount: true
                }
          }).fetch();
  
            window.localStorage.setItem('subcats', JSON.stringify(self.subcats) );
  
            self.contentLoaded = true;
            self.noPosts = 'No posts available.';
  
            $ionicLoading.hide();
            return;        
          });
        },
        onStop: function(err){
  
          if(err){
            self.contentLoaded = true;
            self.noPosts = "No internet connection.";
            console.log(JSON.stringify(err));
            return;
          }
        }
      });
    }
  
    this.getSubcat();
  </code></pre>
  
  <p>When i change this line:</p>
  
  <pre><code>  self.subcats = Products.find({
      catLinkID : $stateParams.idCats
    }
  </code></pre>
  
  <p>To:</p>
  
  <pre><code>  self.subcats = Products.find({
      catLinkID : 7 // 7 for example
    }
  </code></pre>
  
  <p>It is working well ! But as soon as I replace it with <code>$stateParams.idCats</code>, I receive this message coming from the function: No posts available.</p>
  
  <p>Note that there are products using the idCats: 7.</p>
  
  <p>When I log it:</p>
  
  <pre><code>console.log("Test Log: " + $stateParams.idCats);
  </code></pre>
  
  <p>This returns the same number: <code>Test Log: 7</code>.</p>
  
  <p>If you have any suggestion or a starting point to solve this issue, it will be welcome !</p>
  
  <p>Notice that there are no error in the Console (Both server and client side).</p>
  
  <p>Thank you.</p>