I tried doing something like:

```
var vehicle_info = angular.module('psngr.vehicle_info', []).factory('vehicle_info', ['$rootScope', '$timeout', '$q', vehicle_info]);
var name = vehicle_info.getNameOfVclass($rootScope.data.user.vehicles[i].vclass.id);

```

But I get this: 

```
vehicle_info.getNameOfVclass is not a function
at dashboard.js?v=@@TIMESTAMP:288
at angular.js:9369
at angular.js:13189
at l.$eval (angular.js:14401)
at l.$digest (angular.js:14217)
at l.$apply (angular.js:14506)
at l (angular.js:9659)
at S (angular.js:9849)
at XMLHttpRequest.D.onload (angular.js:9790)

```

Why?

Before I would do it like this, in the app.js file:

```
 angular.module('psngr.vehicle_info', []).factory('vehicle_info', ['$rootScope', '$timeout', '$q', vehicle_info]);
 var app = angular.module('app', ['ngRoute', 'ngAnimate', 'route-segment', 'view-segment', 'ngCookies', 'ngImgCrop', 'ngSanitize', 'psngr.payment', 'psngr.storage', 'psngr.unit', 'psngr.vehicle_info']);

```

Where:

```
 app = app.run(function($rootScope, $location, $timeout, $http, $window, storage, unit) {
    $rootScope.unit = unit;
}

```

But I won't want it to have a rootScope, and be global, I only want to load the script file in the html that I use it. so I would like to load the module just in the js file of that html. Is it possible? 

EDIT:

The vehicle\_info.js file that contains the service looks like this:

```
 var vehicle_info = function($rootScope, $timeout, $q) {
function getNameOfVclass(vclass) {
    switch(vclass) {
        case 1:
            return i18n.t('psngr.profile.vehicle.car.midsize');
        case 2:
            return i18n.t('psngr.profile.vehicle.car.large');
        case 3:
            return i18n.t('psngr.profile.vehicle.car.compact');
        case 4:
            return i18n.t('psngr.profile.vehicle.car.scooter');
        case 5:
            return i18n.t('psngr.profile.vehicle.car.motorcycle');
        case 6:
            return i18n.t('psngr.profile.vehicle.car.suv');
        case 7:
            return i18n.t('psngr.profile.vehicle.car.van');
        case 8:
            return i18n.t('psngr.profile.vehicle.car.pickup');
        case 9:
            return i18n.t('psngr.profile.vehicle.car.truck');
        case 10:
            return i18n.t('psngr.profile.vehicle.car.bicycle');
        default:
            return i18n.t('psngr.profile.vehicle.car.midsize');
    }
}

//Exposed methods
return {
    /*  get name of vclass */
    getNameOfVclass: function(vclass) {
        return getNameOfVclass(vclass);
    },
};
};

```