<commit_before>angular.module('LinkCtrl', ['getLinks'])

.controller('LinkCtrl', ['$scope', '$stateParams', '$http', 'getLinkstoBasket', function(
  $scope,
  $stateParams,
  $http,
  getLinkstoBasket
) {

  var tabUrl,
      pageInfo;

  $scope.basketID = $stateParams.basketID;
  $scope.basketName = $stateParams.basketName;

  // get the current URL
  chrome.tabs.getSelected(null, function(tab) {

      tabUrl = tab.url;

  });

  getLinkstoBasket($stateParams.basketID).then(function(response) {

    // $$hashKey: "object:11"
    // created_at: "2015-05-16T11:56:50.556-04:00"
    // description: "Share your videos with friends, family, and the world"
    // folder_id: 2
    // id: 4
    // image: null
    // message: "Where did he go?"
    // title: "Hatbox Ghost Reappears in Haunted Mansion | Disneyland Resort - YouTube"
    // updated_at: "2015-05-16T11:56:50.556-04:00"
    // url: "https://www.youtube.com/watch?v=oAg3pP-PYok"
    $scope.links = response.data;

  })

  $scope.saveLink = function(basketID) {

    chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
      chrome.tabs.sendMessage(tabs[0].id, {ping: "Send Page Info"}, function(response) {

        pageInfo = response.page_info;
        console.log(pageInfo);
        console.log(basketID);

        var promise = $http({
          url: 'http://localhost:3000/new_link',
          dataType: 'json',
          method: 'POST',
          params: {
            url: tabUrl,
            title: pageInfo.title,
            message: $scope.message,
            description: pageInfo.description,
            image: pageInfo.info,
            uniqueId: basketID
          },
          headers: {'Content-Type': 'application/json'}
        }).success(function(response) {
          
          console.log(response);
          return response;

        }).error(function(response) {

          return {'status': false};

        })
        
      }); // chrome.tabs.sendMessage

    }); // chrome.tabs.query

  } // saveLink()

}])<commit_msg>user can now save link to basket, and have the links update properly<commit_after>angular.module('LinkCtrl', ['getLinks'])

.controller('LinkCtrl', ['$scope', '$stateParams', '$http', 'getLinkstoBasket', function(
  $scope,
  $stateParams,
  $http,
  getLinkstoBasket
) {

  var tabUrl,
      pageInfo;

  $scope.basketID = $stateParams.basketID;
  $scope.basketName = $stateParams.basketName;

  // get the current URL
  chrome.tabs.getSelected(null, function(tab) {

      tabUrl = tab.url;

  });

  getLinkstoBasket($stateParams.basketID).then(function(response) {

    // $$hashKey: "object:11"
    // created_at: "2015-05-16T11:56:50.556-04:00"
    // description: "Share your videos with friends, family, and the world"
    // folder_id: 2
    // id: 4
    // image: null
    // message: "Where did he go?"
    // title: "Hatbox Ghost Reappears in Haunted Mansion | Disneyland Resort - YouTube"
    // updated_at: "2015-05-16T11:56:50.556-04:00"
    // url: "https://www.youtube.com/watch?v=oAg3pP-PYok"
    $scope.links = response.data;

  })

  $scope.saveLink = function(basketID) {

    chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
      chrome.tabs.sendMessage(tabs[0].id, {ping: "Send Page Info"}, function(response) {

        pageInfo = response.page_info;
        console.log(pageInfo);
        console.log(basketID);

        var promise = $http({
          url: 'http://localhost:3000/new_link',
          dataType: 'json',
          method: 'POST',
          params: {
            url: tabUrl,
            title: pageInfo.title,
            message: $scope.message,
            description: pageInfo.description,
            image: pageInfo.info,
            uniqueId: basketID
          },
          headers: {'Content-Type': 'application/json'}
        }).success(function(response) {
          
          $scope.links = response;

        }).error(function(response) {

          return {'status': false};

        })
        
      }); // chrome.tabs.sendMessage

    }); // chrome.tabs.query

  } // saveLink()

}])
{'fraction_non_alphanumeric': 0.15017064846416384, 'fraction_numerical': 0.025353486104339348, 'mean_word_length': 2.388109000825764, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3376068', 'n_tokens_mistral': 1390, 'n_tokens_neox': 1285, 'n_words': 255}