title: Unknown provider
body: <p>I have come across a quite peculiar error on my AngularJS code of a web application.</p>
  
  <p>I have an application which has a form for inserting new data in the database, but before that it's going to look for any coincidences.</p>
  
  <p>Now, the object that we insert in database has a series of collections and if it already exists the application will show the whole content on the UI, where the user will be able to add new items to the collections</p>
  
  <p>The collections are made of entities which each have their own view and independent access to them from the navbar menu, so when I call the add new item method in the form it's actually recycled from the previous one, and here is the funny part</p>
  
  <p>I have done three of them in the form and they all work fine, same view shows, same functionality, but when I try with the fourth one, this error comes up:</p>
  
  <pre><code>angular.js:13294 Error: [$injector:unpr] Unknown provider: pagingParamsProvider &lt;- pagingParams &lt;- TreatmentController2
  http://errors.angularjs.org/1.5.2/$injector/unpr?p0=pagingParamsProvider%20%3C-%20pagingParams%20%3C-%20TreatmentController
  </code></pre>
  
  <p>Now, the even funnier thing is that I am using the same code for the controller and for the view as what is used on the separate entity view access, yet when I do it from the form it won't work.</p>
  
  <p>If I remove the paging params injection, it loads the view, but of course, it loses all functionality.</p>
  
  <p>Here's the code:</p>
  
  <p>Controller:</p>
  
  <pre><code>  (function() {
      'use strict';
  
      angular
          .module('vivaxDataManagerApp')
          .controller('TreatmentController', TreatmentController);
  
      TreatmentController.$inject = ['$scope', '$state', 'Treatment', 'TreatmentSearch', 'ParseLinks', 'AlertService', 'pagingParams', 'paginationConstants'];
  
      function TreatmentController ($scope, $state, Treatment, TreatmentSearch, ParseLinks, AlertService, pagingParams, paginationConstants) {
          var vm = this;
          vm.loadAll = loadAll;
          vm.loadPage = loadPage;
          vm.predicate = pagingParams.predicate;
          vm.reverse = pagingParams.ascending;
          vm.transition = transition;
          vm.clear = clear;
          vm.search = search;
          vm.searchQuery = pagingParams.search;
          vm.currentSearch = pagingParams.search;
          vm.loadAll();
  
  
  
           function loadAll () {
                  if (pagingParams.search) {
                      TreatmentSearch.query({
                          query: pagingParams.search,
                          page: pagingParams.page - 1,
                          size: paginationConstants.itemsPerPage,
                          sort: sort()
                      }, onSuccess, onError);
                  } else {
                      Treatment.query({
                          page: pagingParams.page - 1,
                          size: paginationConstants.itemsPerPage,
                          sort: sort()
                      }, onSuccess, onError);
                  }
                  function sort() {
                      var result = [vm.predicate + ',' + (vm.reverse ? 'asc' : 'desc')];
                      if (vm.predicate !== 'id') {
                          result.push('id');
                      }
                      return result;
                  }
                  function onSuccess(data, headers) {
                      vm.links = ParseLinks.parse(headers('link'));
                      vm.totalItems = headers('X-Total-Count');
                      vm.queryCount = vm.totalItems;
                      vm.treatments = data;
                      vm.page = pagingParams.page;
                  }
                  function onError(error) {
                      AlertService.error(error.data.message);
                  }
              }
  
              function loadPage (page) {
                  vm.page = page;
                  vm.transition();
              }
  
              function transition () {
                  $state.transitionTo($state.$current, {
                      page: vm.page,
                      sort: vm.predicate + ',' + (vm.reverse ? 'asc' : 'desc'),
                      search: vm.currentSearch
                  });
              }
  
              function search (searchQuery) {
                  if (!searchQuery){
                      return vm.clear();
                  }
                  vm.links = null;
                  vm.page = 1;
                  vm.predicate = '_score';
                  vm.reverse = false;
                  vm.currentSearch = searchQuery;
                  vm.transition();
              }
  
              function clear () {
                  vm.links = null;
                  vm.page = 1;
                  vm.predicate = 'id';
                  vm.reverse = true;
                  vm.currentSearch = null;
                  vm.transition();
              }
  
          }
      })();
  </code></pre>
  
  <p>The call from the HTML code:</p>
  
  <pre><code>&lt;div class="form-group-row"&gt;
              &lt;label class="col-md-2 form-control-label"&gt;Insert new Treatment:&lt;/label&gt;
              &lt;div class="col-md-2"&gt;
                  &lt;a class="btn btn-success" ng-click="newTreatment()"&gt;
                      &lt;span class="glyphicon glyphicon-plus"/&gt;
                  &lt;/a&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>The function in the form controller:</p>
  
  <pre><code> $scope.newTreatment = function () {
                  $scope.myHidingValue=true;
                  $uibModal.open({
                      templateUrl: 'app/entities/treatment/treatment-dialog.html',
                      controller: 'TreatmentController',
                      size: 'lg',
                      controllerAs: 'vm',
                      backdrop: 'static',
                      resolve: {
                          entity: function () {
                              return {};
                          }
                      }
                  }).result.then(function (result) {
                      $scope.publi = result;
                  }, function () {
                  })
              };
  </code></pre>
  
  <p>I'm only posting what I think is the most relevant code, as I have thousands of lines in this project, but if necessary, I don't mind posting more code</p>
  
  <p>Thank you all in advance</p>
  
  <p>Steven</p>