Is it possible to use interpolated attribute values that register during
the compile phase? I'm trying to use an interpolated value in an
angular-material project like so:
<section ng-controller="MainController as main">
<md-button ng-click="main.ToggleNav()">Show Nav</md-button>
<md-sidenav component-id="{{ main.NavID }}">
<md-toolbar> ... </md-toolbar>
</md-sidenav>
</section>
<script type="text/javascript">
app.controller('MainController', ['$mdSidenav', function($mdSidenav) {
this.NavID = 'main-nav';
this.ToggleNav = function() {
$mdSidenav(this.NavID).toggle();
}
}]);
</script>
When executed -- I get:
No instance found for handle" "main-nav"
Obviously the component-id attribute is being registered as "{{ main.NavID
}}" and not the substituted value.
I've been away from Angular for quite some time -- is there perhaps a
generic ngAttr directive that's similar to ngHref / ngSrc but more flexible?
Many thanks,
~ Brice
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.