Accepted answer is right but also wrong (it gives you the correct code but doesn't explain the reasoning as to why this won't work). $http.put does return a promise that gives you success and error callbacks. The information in that answer is just flat out incorrect.
You can't return values from success and error because they are callbacks and not part of the A+ promise standard. They do not chain, because they do not return a new promise each time you invoke them, they instead return the same promise.
For this reason, you should more-or-less always use then/catch - both of these play well with other non-$http promises and are standard methods. They also support chaining because then and catch will return a new version of the promise with each subsequent invocation - so the return value from the first then will be passed to the second then (and so forth).
The code that @Pankaj has posted is more or less correct, I would make a minor modification and use catch instead of passing two callbacks to then because it is easier to scan.
bar.updateData = function(val) {
return $http.put('url/foo', { param: val })
.then(function(res) {
return res.data;
})
.catch(function(error) {
return 'this is a string';
});
};