1. First response: I don't think angularjs allows you to interpolate 
(create a attribute name from a binding). Out of curiosity I checked around 
and tested for a solution. I am stumped myself. 

2. I am confused by your use of $compile - so I am not sure if you new the 
point I made in #1 and you are using $compile service as a way to work the 
binding.  

Sorry - I will watch to see your solution. 

On Friday, February 13, 2015 at 10:45:37 AM UTC-5, Al J wrote:
>
> I have these scope elements (in a directive)
>
> scope.itemId = 5;
> scope.iconList = [
>   {"type":"radio-state-icon","name":"lock:unlock"},
>   {"type":"single-state-icon","name":"bin"},
>   {"type":"single-state-icon","name":"picture"}
> ]; 
>
> And this template
>
>    var tmpl='<span ng-repeat="icon in iconList" {{icon.type}} 
> data-item-id="{{itemId}}" data-icon="{{icon.name}}"></span>';
>
> And this code
>
>    var el = angular.element(tmpl);
>    var compiled = $compile(el);
>    element.append(el);
>    compiled(scope);
>
> And the resulting html 
>
>   <span ng-repeat="icon in iconList" {{icon.type}} data-item-id="5" 
> data-icon="lock:unlock" class="ng-scope"></span>
>   <span ng-repeat="icon in iconList" {{icon.type}} data-item-id="5" 
> data-icon="bin" class="ng-scope"></span>
>   <span ng-repeat="icon in iconList" {{icon.type}} data-item-id="5" 
> data-icon="picture" class="ng-scope"></span>
>
> How can it be doing one part of my template and not another ?
>
>
>

-- 
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.

Reply via email to