angular / material

Material design for AngularJS
https://material.angularjs.org/
MIT License
16.55k stars 3.39k forks source link

navbar: active tab not selected with ui-router #10585

Open Liam-Tait opened 7 years ago

Liam-Tait commented 7 years ago

Actual Behavior:

navigating to http://s.codepen.io/liamtait/fullpage/pPoZMY?#/routeA does not select the routeA button

AngularJS Versions: *

Additional Information:

Do not modify the titles or questions. Simply add your responses to the ends of the questions. Add more lines if needed.

stephengardner commented 7 years ago

+1 !!!!

benoitbc commented 7 years ago

+1

garretwilson commented 7 years ago

I brought this up on Stack Overflow and someone came up with a reasonable manual workaround.

This is something that should be integrated into mdNavBar, though, and in fact the documentation makes it sound like it already supports this. But it's not.

Paragonid commented 7 years ago

I couldn't make it work by garretwilson example, but next setup helped:

<md-nav-bar md-selected-nav-item="$ctrl.currentNavItem" nav-bar-aria-label="navigation links">
        <md-nav-item ng-repeat="page in ::$ctrl.pages" md-nav-sref="{{::page.state}}" name="{{::page.name}}">{{::page.label}}</md-nav-item>
      </md-nav-bar>

And the controller (coffeescript):

panelController = (_, $timeout, $state, User, Routes) ->
  @pages = [
    state: Routes.tooltips
    name: 'tooltips'
    label: 'Helpers'
  ,
    state: Routes.events
    name: 'events'
    label: 'Events'
  ,
    state: Routes.users
    name: 'users'
    label: 'Users'
  ]

  $timeout =>
    @currentNavItem = _.find(@pages, state: $state.current.name).name
mdehghani commented 7 years ago

+1

ThomasBurleson commented 7 years ago

@EladBezalel - let's get this one fixed for v1.1.5; if possible.

Logrythmik commented 7 years ago

+1! 👍