0

I am getting an error TypeError: Cannot read property 'get' of undefined.i have tried so many ways but not able to solve.

mycode is login.controller.js

(function () {
    'use strict';

    angular
        .module('app')
        .controller('LoginController', LoginController);

    LoginController.$inject = ['$location', 'AuthenticationService', 'FlashService'];
    function LoginController($location, AuthenticationService, FlashService) {
        var vm = this;

        vm.login = login;

        (function initController() {
            // reset login status
            AuthenticationService.ClearCredentials();
        })();

        function login() {
     var  usename=vm.username;
     var   password=vm.password;

            vm.dataLoading = true;

       $http.get('http://localhost:8080/ProjectManagement/REST/Login/Check?usename='+usename+'&password='+password+'').success(function(data, status, headers, config,response){

              if (data=="0")
                  {

                  }
              else
                  {


                  }


        }).error(function(data, status, headers, config,response) {


        });

        };
    }

})();

1 Answer 1

1

You missed to add $http dependency inside you controller, make sure all the dependencies are injected before using it.

Code

LoginController.$inject = ['$location', 'AuthenticationService', 'FlashService', '$http'];
function LoginController($location, AuthenticationService, FlashService, $http) {
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.