1

I'm trying to make some button disappear when I logout, but if I don't put reload command It won't reload and button wouldn't disappear. After I put reload command view doesn't change because the process end at reload line.

Here my code :

$scope.logout = function(){
    deleteCookie("Username","/");
    location.reload();
    $location.path('/view1');


}

Please help !

UPATE: app.js

'use strict';

// Declare app level module which depends on views, and components
angular.module('myApp', [
  'ngRoute',
  'myApp.view1',
  'myApp.view2',
  'myApp.viewLogin',
  'myApp.SaveCafeDetail',
  'myApp.viewUserprofile',
  'myApp.viewManageuser',
  'myApp.viewEditcafe',
  'myApp.version'
]).
config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {
  $locationProvider.hashPrefix('!');

  $routeProvider.otherwise({redirectTo: '/view1'});
}]);
Kitsakorn P
  • 101
  • 1
  • 10

3 Answers3

0

You can use absolute url or just add target="_self" on your <a> tag, if you use it in your HTML.

Commercial Suicide
  • 14,875
  • 14
  • 62
  • 80
0

I suggest this approach..

     $scope.logout = function(){
     deleteCookie("Username","/");

        if (-----)  {   //deletecokkie value is null 
       window.location = "http://.../..."  //full URL of the designation;
          }

    }
Aman
  • 778
  • 2
  • 11
  • 35
0

To reload to another view, simply use:

$state.go("your_view_name");

Hope this helps!

Andre Debuisne
  • 303
  • 1
  • 3
  • 15