Hey Sander,
Thanks for pointing me to ng-attr. I figured something like that was bound
to exist! Documentation is in Developer Guide / Directives
(https://docs.angularjs.org/guide/directive)
Unfortunately in the MD component naming case; it doesn't appear to
register in time and I'm still getting
No instance found for handle" "component-name"
Re: Why?
The component-id attribute is similar to the element.ID attribute, in that
it's unique and meaningfully named by the developer. I wanted to abstract this
naming to my controller, so I can name it in one place and have the
toggle/open/close functions adhere to that name. One more level of abstraction!
;)
~ Brice
On Thursday, November 13, 2014 1:22:59 AM UTC-5, Sander Elias wrote:
>
> Hi Brice,
>
> Did you try (drum-roll..) ng-attr-component-id?
> It’s just there, only the documentation is on a strange place. Not sure if
> that’s on purpose!
>
> May I ask why you are naming an crucial part of your (material) design
> dynamically? Are you generating sub-modules on the fly?
> hmm. I just looked into the source of angularMD. A dirty hack that solves
> your problem is quite easy.
> something like:
>
> function mdSideNavName () {
> var ddo = {
> restrict: 'A',
> require: 'md-sidenav',
> link: function (scope,elm,attr,mdSideNav) {
> attr.$observe('mdSideNavName', function (name){
> if (name) { //only regiser a new existing name!
> mdSideNav.$$handle = name;
> }
> })
> }
> };
> returm ddo
> }
> angular.module('mdHacks')
> .directive('mdSideNavName', mdSideNavName);
>
> I din’t try above code, so it might need some fiddling before actually
> working.
>
> Regards
> Sander
>
>
--
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.