var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.arr = [1,2,3,4,5];
app.directive('myDire', function($rootScope) {
template: '<button ng-click="initValue()">init</button>\
<button ng-click="setValue()">setValue</button>\
<button ng-click="setTest()">setTest</button>\
<button ng-click="copyTest()">copyTest</button>\
</br>show:<pre>{{show}}<pre>\
</br>test:<pre>{{test}}<pre>\
</br>ng-repeat:<span ng-repeat="item in show">{{item}}</span>',
link: function ($scope, element, attrs){
$scope.initValue = function(){ $scope.show = [];};
$scope.setValue = function(){ $scope.show = [4,5,6]};
$scope.setTest = function(){ $scope.show = $scope.test};
$scope.copyTest = function(){
$scope.show = JSON.parse(JSON.stringify($scope.test));