خرید بک لینک

Vote count: 0

Hi I want to change the url on successful login. The login url is localhost/filename/login.html and on successful the url is localhost/filename/index.html#/birds_eye. Am using angularjs 1.3.14. Here is the app.js code

var  app = angular.module('cirqSignUp', 

['cirq.controllers','cirq.services','ngRoute','ngStorage'])

app.config(['$routeProvider', function($routeProvider) {
    $routeProvider
    .when('/login',{templateUrl: '/login.html',   controller: 'login'})
    .when('/birds_eye', {templateUrl: 'pages/birds_eye_view.html',   controller: 'birdsEye',reloadOnSearch: false})
    //.when('/analytics', {templateUrl: 'pages/analytics.html',   controller: 'birdsEye'})
    //.when('/items', {templateUrl: 'pages/listitems.html',   controller: 'birdsEye'})
    .when('/items/import_export', {templateUrl: 'pages/items/import_export.html',   controller: 'importExport'})
    .when('/items/categories', {templateUrl: 'pages/items/categories.html',   controller: 'forCategory'})
    //.otherwise({redirectTo: '/birds_eye'});
}])

and here is the controller code

.controller('login', ['$scope','$http','Services','$rootScope','$localStorage', '$sessionStorage','$location', function($scope,$http,Services,$rootScope,$localStorage, $sessionStorage,$location){
$('.error').hide();
$scope.loginRest = function(restLogin){
    //
    //alert(JSON.stringify(restLogin));
    var request = Services.loginDashboard(restLogin);
    request.success(function(res,status,headers,config){
        alert(status);
        //retu
        $localStorage.resDataRest = res.useremailid;
        $localStorage.resTotalSales = res.dashBoard.todayssales;
        $localStorage.resTotalTransct = res.dashBoard.todaystransactions;
        console.log(JSON.stringify($rootScope.resDataRest));
        $location.path('/birds_eye');
        //afterLogin(res.useremailid);
        //console.log($rootScope.resDataRest)
    }).error(function(res,status,headers,config){
        $scope.resMsg = res.responsemessage;
            $('.error').show();
        //alert(status);
    });
};
//$rootScope.resDataRest = $scope.getVar;
/*function afterLogin(res){
    $scope.data1 = res;
    //$rootScope.afterLoginData = $scope.data1;
    alert(JSON.stringify($scope.data1));
}

*/}])

The problem i face using $location is the url is not getting updated and tried using windows.location but the problem with window.location is the response object which I save in a scope/rootscope variable is getting null'ed. Please help me

asked 25 secs ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 14 فروردين 1395 ساعت: 0:58

صفحه بندی