I try to create a function within an angular directive which should just change an object value.
It won't work with passing the variable directly to the function:
<body ng-controller="MainCtrl">
    <div test ng-click="changeVar(variable.value)">{{ variable.value }}</div>
</body> 
app.directive('test', [function(){
    return {
        link: function(scope, elem, attrs) {
          scope.variable = {
            value : "bla"
          }; 
          scope.changeVar = function(value) {
            value = "hhuhu"
          };
        }
    }
}]);
But passing the parent object does:
<body ng-controller="MainCtrl">
    <div test ng-click="changeObj(variable)">{{ variable.value }}</div>
</body>
app.directive('test', [function(){
    return {
        link: function(scope, elem, attrs) {
          scope.variable = {
            value : "bla"
          }; 
          scope.changeObj = function(obj) {
            obj.value = "hhuhu"
          };
        }
    }
}]);
Why do I have to pass the parent Object to the function to overwrite the value, and cannot pass the value directly to overwrite it? Am I missing something?