Merhaba Başarılı oturum açmada URL'yi değiştirmek istiyorum. Oturum açma URL'si localhost/dosyaadı/login.html ve başarılı olduğunda url, localhost/filename/index.html #/birds_eye şeklindedir. Angularjs 1.3.14 kullanıyorum. İşte app.js koduBaşarılı girişte url'yi değiştir angularjs
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'});
}])
ve burada kontrolör kodunu
.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);
//return
$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));
}
olduğunu * /}])
i $ konumu kullanarak karşıya sorun url almıyor olduğunu windows.location kullanarak güncellenen ve denedim ama window.location ile problemi bir kapsamda kaydettiğim cevap nesnesi/rootscope değişkenine null'ed oluyor. $location doc itibaren bana
'Services.loginDashboard()' Bir '$ http' söz dönüyor? – Malk
Bu, '$ location.path ('/ birds_eye') kullanan bir SPA olduğundan, oturum açtıktan sonra' 'localhost/filename/#/birds_eye' 'ye gitmeniz gereken tek şey. Biraz endişeliyim çünkü url, localhost/dosyaadı/index.html #/birds_eye' şeklindedir. Bir web sunucusu kullanıyor musunuz? Bunu nerede test ediyorsunuz? Hizmetin ne olacak? –
evet bir servisin yanı sıra bir web sunucusu kullanıyorum. Index.html sayfanın ortak bölümünü içerir, bu nedenle URL böyle bir şeydir. – Prashanth