Remove login menu? (Angularjs and UI router)

Asked

Viewed 128 times

0

Good afternoon,

I am participating in a project and I am using Angularjs and UI-router, much of it is already done, but I do not know how to remove the login menu, I would like it to appear only after authentication. If someone can give a force there, I thank you already. Follow below print and routes.

Menu aparecendo no login

Routes:

const boletoCorretoraState = {
  name: 'boletoCorretora',
  url: '/boletoCorretoraPublico',
  component: 'boletoCorretora',
};

const boletoEstoqueState = {
  name: 'boletoEstoque',
  url: '/boletoEstoquePublico',
  component: 'boletoEstoque',
};

const consolidadoState = {
  name: 'consolidado',
  url: '/consolidado',
  component: 'consolidado',
};

const consultaState = {
  name: 'consulta',
  url: '/consulta',
  component: 'consulta',
};

const loginState = {
  name: 'login',
  url: '/login',
  component: 'login',
};

$stateProvider.state(boletoCorretoraState);
$stateProvider.state(boletoCorretora2State);
$stateProvider.state(boletoEstoqueState);
$stateProvider.state(boletoEstoque2State);
$stateProvider.state(consolidadoState);
$stateProvider.state(consultaState);
$stateProvider.state(loginState);

$urlRouterProvider.otherwise('/login');
$locationProvider.html5Mode(true);

}

1 answer

0


Guilherme, in your case I believe I could nestle the States that need a logged-in user (Example of nested States) and in its menu directive use the $state is. to check that the current status is no longer login.

Still da para consulta seu service/cache para verificar se um usuário autenticado e evitar a sugestão acima.

  • I got it, thank you very much!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.