Problems with using Angularjs ui-route

Asked

Viewed 36 times

0

I am using SPA utilizo Angularjs and UI-ROUTE

I wish to click on a menu item to write the selected item in a bar that is in the header and not in the ui-view. I can assign the value to a controller’s $Scope variable but it does not occur to scroll on the page

<div ng-controller="CtrlHome">
  <h1>Menu</h1>
  <ul >

  <li >
  <a ui-sref="home" class="dropdown-toggle"  data-toggle="dropdown">Home </a>
  </li>

  <li >
  <a ui-sref="pedido" class="dropdown-toggle"  data-toggle="dropdown">Pedido</a>
  </li>

  </ul>

</div>

<div>
  <p>Item Selecionado: {{pagina}}</p>
</div>

  • It would also be beneficial to include this code in the question.

1 answer

0

Move the header into the view, or share the loaded item on view with header - via service, for example, or (not recommended) $rootScope.

(Post your code. So we can suggest implementations based on it.)

Browser other questions tagged

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