title: How to use Injector Function on Ionic Creator?can I create a loggin app?
body: <p>I am trying to create a login authentication for app in ionic creator. This function Stops me from Sending it to the page. It keeps on giving error</p>
  
  <p><img src="https://i.stack.imgur.com/M8Pff.png" alt="Screenshot of that error"></p>
  
  <p>///this code of my login page controller</p>
  
  <pre><code> function ($scope, $rootScope, $stateParams, $location, AuthenticationService) {
          // reset login status
          AuthenticationService.ClearCredentials();
  
          $scope.login = function () {
              $scope.dataLoading = true;
              AuthenticationService.Login($scope.username, $scope.password, function(response) {
                  if(response.success) {
                      AuthenticationService.SetCredentials($scope.username, $scope.password);
                      $state.go('tabsController.results', params);
                      $location.path('/');
                  } else {
                      $scope.error = response.message;
                      $scope.dataLoading = false;
                  }
              });
          };
      }
  </code></pre>
  
  <p>///and here goes my code for service </p>
  
  <pre><code>.factory('AuthenticationService',
      ['Base64', '$http', '$cookieStore', '$rootScope', '$timeout',
      function (Base64, $http, $cookieStore, $rootScope, $timeout) {
          var service = {};
  
          service.Login = function (username, password, callback) {
  
  
  
              $http.post('/api/authenticate', { username: username, password: password })
                 .success(function (response) {
                      callback(response);
                 });
  
          };
  
          service.SetCredentials = function (username, password) {
              var authdata = Base64.encode(username + ':' + password);
  
              $rootScope.globals = {
                  currentUser: {
                      username: username,
                      authdata: authdata
                  }
              };
  
              $http.defaults.headers.common['Authorization'] = 'Basic ' + authdata; 
              $cookieStore.put('globals', $rootScope.globals);
          };
  
          service.ClearCredentials = function () {
              $rootScope.globals = {};
              $cookieStore.remove('globals');
              $http.defaults.headers.common.Authorization = 'Basic ';
          };
  
          return service;
      }])
  </code></pre>
  
  <p>every time i try to run the program my Browser show error...
  I would be happy to be helped...
  thakyou</p>