'use strict';

/**
 * @ngdoc function
 * @name upstreamApp.controller:UserCtrl
 * @description
 * # UserCtrl
 * Controller of the upstreamApp
 */
angular.module('upstreamApp')
  .controller('UserCtrl', function ($scope, userService, currentUserService, $resource, $routeParams) {
	var user = userService.get({id: $routeParams.userId}, function() {
   		$scope.user = user;
	});
    
	$scope.follow = function(currentUser){
        if (user.following == false) {
            userService.follow({id: currentUser.id});
            user.following = true;
        }
        else {
            userService.unfollow({id: currentUser.id});
            user.following = false;
        }
    }
		   
    
    
  });

@@ -269,16 +269,26 @@
 teParams
+, $mdToast
 ) %7B%0A%09var
@@ -554,16 +554,122 @@
 = true;%0A
+%09%09%09$mdToast.show($mdToast.simple().content('You now follow ' + user.username).position('right bottom'));%0A%0A
         
@@ -777,16 +777,127 @@
  false;%0A
+%09%09%09$mdToast.show($mdToast.simple().content('You no longer follow ' + user.username).position('right bottom'));%0A
         

add toast when following/unfollowing