I got this simple directive :
app.directive('participants',function(){
return{
restrict:'E',
scope:{
allParticipants:"=",
appendOption:"="
},
templateUrl:'/templates/participants.html',
link: function(scope,element,attr){
scope.$watch('allParticipants',function(value){
if (value){
value.length > 3 ? showShortParticipants() : showFullParticipants()
}
});
}
}
});
In short - I would like to create a different child dom element depends on the value
. For example, if value.length
bigger than 3, create some element of type 1, and if not to create element of type 2 (different template from 1).
Whats the elegant way to do that?
Thank you