Material: md-nav-bar not passing params to ui-router.

Created on 11 Jun 2016  路  2Comments  路  Source: angular/material

Actual behavior:

  • What is the issue?
    ui-router state params are not being passed by md-nav-sref. Literal strings are being passed though.

<md-nav-item ng-repeat="link in nav.navlinks" md-nav-sref="root.category({category: link.prettyUrl})" name="{{prettyUrl}}">{{link.name}}</md-nav-item>

In this case, it seems link.prettyUrl is not evaluated.

However, it works if changed from

md-nav-sref="root.category({category: link.prettyUrl})"

to

md-nav-sref="root.category({category: '{{link.prettyUrl}}'})"

Angular Versions: *

  • Angular Version: 1.5.6
  • Angular Material Version: 1.1.0-rc.5

Additional Information:

  • Browser Type: chromium
  • Browser Version: 51
  • OS: GNU/Linux x86_64

Most helpful comment

This is due to how md-nav-sref works - md-nav-sref is interpolated in the template as a string variable wholesale, see here. As the directive has no knowledge of what link is, it then fails.

I think this is ok behavior, as Angular Material shouldn't get in the business of interpreting UI Router's state params from the attribute value.

All 2 comments

This is due to how md-nav-sref works - md-nav-sref is interpolated in the template as a string variable wholesale, see here. As the directive has no knowledge of what link is, it then fails.

I think this is ok behavior, as Angular Material shouldn't get in the business of interpreting UI Router's state params from the attribute value.

My bad. I should have looked up the src. Thanks.

Was this page helpful?
0 / 5 - 0 ratings