Is there a way to tell angular that a particular function in $scope is dependant on some other fields in $scope? I would like to hide some functionality in data model, for example:
$scope.user = {
name: "John",
surname: "Smith",
getUsername: function() {
return [this.name, this.surname].join(' ');
}
}
Then I would like to use $scope.user.getUsername() in the html template, but when I change $scope.user.name, template doesn't refresh. Is the a way to tell angular that this function is dependant on other fields?