Figured it out. Basically I was trying to alter scope in the factory. Here's the working code:
Factory:
arc.factory('User', ['$resource', function($resource) {
return $resource('/users/:op/:id.json', {}, {
login: { method:'POST', params:{ op:'login' } },
logout: { method:'GET', params:{ op:'logout' } },
getCurrentUser: { method:'GET', params:{ op:'getCurrentUser' } }
});
}]);
Controller
arc.controller('MainCtrl', ['$scope', '$location', 'User',
function ($scope, $location, User) {
$scope.user = User.getCurrentUser();
$scope.logout = function() {
User.logout(
function(response) {
$scope.user = response.user;
$location.path('/login');
}
);
}
$scope.login = function(username, password) {
User.login({username:username, password:password},
function(response) {
$scope.user = response.user;
$location.path('/');
});
}
}]);
Now the view updates like it's supposed to.
{{ user.name }}