The controller is not reading from the factory

I have a services.js file where I placed my facotry:


     var service = {}; = false;
      service.sendData = function(data){
 = data;

      service.getData = function(){
      return service;


And my controllers, in the controller.js file look like this:

 .controller('recommendedJobsCtrl', function($q,$scope, $ionicSideMenuDelegate,$window,$http,dataShare) {


.controller('jobPostCtrl', function($scope,$ionicSideMenuDelegate,dataShare) {
  $scope.text = '';
var text =  dataShare.getData();    
$scope.text = text;

When I did console.log, i realized that the service.getData isn’t wokring, i.e the receiving controller (jobPostCtrl) isn’t getting anything.
How can i fix this?

Have you included services.js file? If no then include it. If yes then check if it included prior to controller.js

Hi there, when you say include, what do you mean?

I’m sorry I’m new at this. Where am i supposed to include it?

In your HTML page where all js files are included using

yes, it’s included. But I think what’s wrong is the second controller isn’t getting the data and Im not sure why.