I have got the following directive:
app.directive('ngAvatar', function() {
return {
restrict: 'E',
replace: true,
template: '<img class="avatar-medium" ng-src="{{url}}" />',
link: function(scope, elem, attrs) {
console.log(attrs);
var aType = attrs.avatarType;
var aId = attrs.avatarId;
console.log("Type: "+ aType);
console.log("Character ID:"+ aId);
var baseUrl = "http://api-character.com/";
switch(aType){
case "character":
scope.url = baseUrl + "Character/"+aId+"_256.jpg";
}
}
}
});
Unfortunately the directive is not picking up the avatar_id inside of the directive. As you can see I am console logging the attributes:
console.log("Type: "+ aType);
console.log("Character ID:"+ aId);
In my view I am using this directive like so:
<ng-avatar avatar_type="character" avatar_id="{{character.character_id}}"></ng-avatar>
The following is the output of my console in Chrome. As you can see the avatar_id is showing as blank but on inspection of the attrs you can see that the attribute is there but just not showing in the directive code.
Chrome Console:

Does anyone have any idea why it would not work?
Thanks