I've been working with a function inside the controller:
$scope.passValues = function (param1){
return "foo";
};
console.log($scope.passValues());
It logs foo
, but then I tried this:
$scope.passValues = function (param1){
return param1;
};
console.log($scope.passValues());
I'm a bit puzzled because:
$scope.passValues = function (param1){
console.log(param1);
return param1;
};
This will log robert
, which is correct when used as passValues(item.firstName)
.
My issue lies in the second example, where I need the function to correctly return the value of param1 for later use in the controller.