I want to fetch data in a controller that uses a factory:

**controller.js**

```
  $scope.days = [function(start, end, timezone, callback) {
      calendarFactory.query({
        userId: $scope.userId
      })
      .$promise.then(function(data) {
          angular.forEach(data,function(day){
              days.push({
                  id: day.id,
                  title: day.title,
                  start: day.start
              });
          });
          callback(days);
      });
  }];
}

```

**services.js**

```
.factory('calendarFactory', ['$resource', 'baseURL', function($resource, baseURL) {

  return $resource(baseURL + 'days/:id', null, {
      'update': {
          method: 'PUT'
      },
      'query': {
          method: 'GET',
          isArray: true
      }
  });

}])

```

A **day object** looks like this:

```
{
"start": "2017-02-09T00:00:00.000Z",
"allDay": true,
"userId": "1",
"id": "589cdc7e7ff9810a76a664ec"
}

```

I want to query `days` with a specific `userId`. How can I do that?