Closed
Description
I've written a breadcrumb directive which takes an array of crumbs, each with a name and sref property. I'm trying to bind the ui-sref
directive ($StateRefDirective
) to use the evaluated attribute, but it's not working. When the ui-sref
directive's link
function is called, the attrs.uiSref
value is undefined
, but immediately after the running of the function becomes available as the correct value.
angular.module('myApp').directive 'breadcrumb', ->
scope: { crumbs: '=' }
replace: true
template: '
<nav class="breadcrumbs">
<a ui-sref="{{crumb.sref}}" ng-repeat="crumb in crumbs">{{crumb.name}}</a>
</nav>
'
Inside the $StateRefDirective
link
method, logging attrs
gives
Attributes {… uiSref: undefined …}
Running the same log after a 100ms timeout gives:
Attributes {… uiSref: "apps.show({appId: crumb.app.id})" …}
Am I doing something wrong, or are dynamic ui-sref
attributes not supported?
Note: Running v0.2.0