I am trying to build a login functionality using angular; but I get reference error:
ReferenceError: $state is not defined I understand $state is not working from inside login function but I am not sure what is the correct procedure to redirect user once login function is called.
My Code:
(function () { 'use strict'; angular .module('app') .controller('authController', authController); authController.$inject = ['$scope','$state']; function authController($scope,$state) { $scope.login = login; $scope.user = {email: '', pass: ''}; }; function login(){ this.dataLoading = true; $state.go("dashboard"); } })();
login()function withinauthController().