I'm having issues chaining controllers with angular and services.

Below is my code.  I get the following error:

Error: [$injector:unpr] http:
//errors.angularjs.org/1.2.16/$injector/unpr?p0=dataFactoryProvider%20%3C-%20dataFactory


angular.module('myApp', [
  'ngRoute',
  'myApp.filters',
  'myApp.services',
  'myApp.directives',
  'myApp.factories',
  'myApp.controllers',  
  'UserApp'
]).

config(['$routeProvider', function($routeProvider) {
  $routeProvider.when('/', {templateUrl: 'partials/home.html', controller: 
'HomeCtrl'});
  $routeProvider.when('/login', {templateUrl: 'partials/login.html', login: 
true});
  $routeProvider.when('/search',{title: 'Search', templateUrl: 
'partials/search.html',controller: 'SearchCtrl'});
  $routeProvider.when('/faqs',{title: 'Faqs', templateUrl: 
'partials/faqs.html', controller: 'FaqCtrl'});
  $routeProvider.when('/signup', {templateUrl: 'partials/signup.html', public: 
true});
  $routeProvider.when('/verify-email', {templateUrl: 
'partials/verify-email.html', verify_email: true});
  $routeProvider.when('/reset-password', {templateUrl: 
'partials/reset-password.html', public: true});
  $routeProvider.when('/set-password', {templateUrl: 
'partials/set-password.html', set_password: true});
  $routeProvider.when('/articles', {templateUrl: 'partials/articles.html', 
controller: 'ArticlesCtrl'});
  $routeProvider.otherwise({redirectTo: '/'});
}]).
run(function(user) {
  user.init({ appId: 'asdfasdfasdf' });
});




//Separate File --'myApp.controllers',  

'use strict';

/* Controllers */

angular.module('myApp.controllers', [])
  .controller('HomeCtrl', ['$scope', function($scope) {

  }])
  .controller('ArticlesCtrl', ['$scope', '$http', function($scope, $http) {
        $scope.loading = true;
        $scope.error = null;

                // Call the back-end API which will be authenticated using our 
session token
                $http({method: 'GET', url: '/articles'}).
                        success(function(data, status, headers, config) {
                                //The API call to the back-end was successful 
(i.e. a valid session)
                                $scope.articles = data;
                                $scope.loading = false;
                        }).
                        error(function(data, status, headers, config) {
                                $scope.error = {
                                        message: "The API call to the back-end 
was not successful. Make sure that your back-end verifies the token.",
                                        link: 
"https://app.userapp.io/#/docs/libs/angularjs/#back-end";
                                };
                                $scope.loading = false;
                        });
  }])

 .controller('SearchCtrl', ['$scope', function($scope) {

$scope.url = 'search.php'; // The url of our search
     //$scope.search = {};
                 
                // Create the http post request
                // the data holds the keywords
                // The request is a JSON request.
                $http.post($scope.url, { "data" : $scope.keywords}).
                success(function(data, status) {
                        $scope.status = status;
                        $scope.data = data;
                        $scope.result = data; // Show result from server in our 
<pre></pre> element
                })
                .
                error(function(data, status) {
                        $scope.data = data || "Request failed";
                        $scope.status = status;                 
                });

  }])

.controller("FaqCtrl", ["$scope","dataFactory", 
      function($scope,dataFactory) {
      getFaqs();
      function getFaqs() {
        dataFactory.getFaqs()
            .success(function (faques) {
                $scope.faqs = faques;
            })
            .error(function (error) {
                $scope.status = 'Unable to load faq data: ' + error.message;
            });
    }
  }])

;


//--Here is my DataFactory that has issues in its own myapp.factories file

angular.module('myApp.factories',[])
.factory('datafactory', ['$http', function($http) {
    //var urlBase = 'services/';
    var urlBase = '/api/faqs/';
    var dataFactory = {};
    dataFactory.getFaqs = function(keywords){
        return $http.get(serviceBase + 'faqs');
    };

}]);






-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to