I am trying to create a custom select directive with some extra functionality.
.directive('singleSelect',function(){
restrict:'A'
scope:{
model:'='
}
link:function(elem,scope,attrs){
elem.bind('click',function(){
scope.vModel=model.slice(0,20);
});
controller:function($scope)
{
//some more manipulation with model and assign to vModel
}
template:'<ul><li ng-repeat="item in vModel"></li><ul>'
});
The problem is that I am assigning the value to vModel but it is not getting updated in the template.
$applybut the code you posted is full of other problems too. Syntax errors likefunction(){ restrict: 'A', there is not much to click in empty '<ul>' element, parameterselemandscopeare in the wrong order in thelinkfunction and in the end, when this finally works, it will just show bunch of bullets (if even that, depends on your css) because there is nothing inside the '<li>'.