title: AngularJS ng-click function not bringing info to new view
body: <p>I am trying to make a friends list. I have it set up so a user can search for friends and click on their image to see their profile, this takes them to the profile where there is information displayed that I have in an array in my service. I have an 'add friend' button that when clicked, changes into a 'remove friend' button and is supposed to add that friend to a new html view. There are a few problems I am running into that I can't seem to figure out.
  1) the button is changing for every user when only clicked on 1 users profile. 
  2) the user is not being added to the friends view.</p>
  
  <p>Here is my service code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var friendProfile = {};
    var userFriends = [];
  
    this.addFriend = function(profileObj) {
        userFriends.push(profileObj);
    };
  
    this.removeFriend = function(profileObj) {
      for( var i = userFriends.length - 1; i &gt;= 0; i--) {
        if (userFriends[i].name === profileObj.name) {
          userFriends.splice(i, 1);
        }
      }
    };</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is my controller:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$scope.friendProfile = {};
    $scope.userFriends = [];
    $scope.currentlyFriends = false;
  
    $scope.addFriend = function(profileObj) {
      mainSvrc.addFriend($scope.friendProfile );
      $scope.currentlyFriends = true;
    };
  
    $scope.removeFriend = function(profileObj) {
      mainSvrc.removeFriend
      ($scope.friendProfile);
      $scope.currentlyFriends = false;
    };</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is the HTML:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>/*profile view with buttons*/
  
  &lt;button class="friend-profbutton"
          ng-click="addFriend(friendProfile)"
          ng-hide="currentlyFriends"&gt;ADD FRIEND&lt;/button&gt;
  
          &lt;button class="friend-profbutton"
          ng-click="removeFriend(friendProfile)"
          ng-show="currentlyFriends"&gt;REMOVE FRIEND&lt;/button&gt;
      &lt;/div&gt;
  
  
  /*friends list it should be coming too*/
          &lt;div ng-repeat="friend in userFriends" ui-sref="friend-profile({id:friend.id})" class="picture-wrapper"&gt;
              &lt;img ng-src="{{friends.profileUrl}}" class="friend-profilePic"&gt;
              &lt;div class="box"&gt;
                &lt;div class="overlay"&gt;
                  &lt;p class="overlay-text"&gt;{{friends.name}}&lt;/p&gt;
                  &lt;a class="view-proflink"&gt;View Profile&lt;/a&gt;
                &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>.state('friend-search', {
              url: '/friend-search',
              templateUrl: '/views/templates/friend-search.html',
              controller: 'friendSearchCtrl'
          })
  
          .state('friend-profile', {
            url: '/friend-profile/:id',
            templateUrl: 'views/templates/friend-profile.html',
            controller: 'friendProfileCtrl'
          })
  
          .state('friends', {
              url: '/friends',
              templateUrl: '/views/templates/friends.html',
  
          });</code></pre>
  </div>
  </div>
  </p>
  
  <p>Can anyone see what I may be doing wrong?</p>