I have an array binded to an attribute of a custom directive. This attribute value is used in my template part. The template run everytime the array gets changed right?. This template creates a div element. Every time the array gets changed the template creates the div element without deleting previous one. Is there a way to delete the previous before re-creating?

```
app.directive("imgslidedynamic",function()  
{     
    return{
            restrict:'EA',
            scope:{
                    imgsc: "=imgsc" ,
                 },

            template:   '<div class="rslides">'+
                          '<div ng-repeat="everyimg in imgsc">'+
                            '<img ng-src="{{everyimg}}"/>'+
                          '</div>'+
                        '</div>'
            ,       

            link:   function(scope,element,attrs)
                    {
                        scope.$watchCollection('imgsc',function(){  
                                    console.log("imgsc changed!");
                        });                         
                    } 
        };
    });

```

The directive call

```
 <imgslidedynamic imgsc="selection"></imgslidedynamic>

```

Here "selection" is an array that is dynamic.