I have an html file that displays a drop down menu of categories that I am getting from a remote database using a php script via an Ajax call. I want to be able to change the title of this html page to the name of the item that I click in the drop down menu. For example, if I click on Heating and cooling in the drop down menu, I want it to change the title of the page to 'Heating and cooling'. I have been googling around for answers, but so far I am only left with more confusion. Btw I am doing this in angularJS. Here is my html file:
<h2> Awesome things </h2>
<div ng-controller="MainCtrl">
<span class="dropdown" on-toggle="toggled(open)">
      <a href class="dropdown-toggle">
        Click me to see some awesome things!
      </a>
      <ul class="dropdown-menu">
        <li ng-repeat="category in categories track by $index"> <!--fix this expression-->
          <a href>{{category}}</a>
        </li>
      </ul>
    </span>
</div>
Here is my MainController file 'main.js':
angular.module('yostartupApp')
  .controller('MainCtrl', function ($scope, $http) {
    $scope.awesomeThings = [
      'HTML5 Boilerplate',
      'AngularJS',
      'Karma',
      'SitePoint'
    ];
  $scope.status = {
    isopen: false
  };
  $scope.toggled = function(open) {
    console.log('Dropdown is now: ', open);
  };
  $scope.toggleDropdown = function($event) {
    $event.preventDefault();
    $event.stopPropagation();
    $scope.status.isopen = !$scope.status.isopen;
  };
  //making ajax calls -- current step I'm working on DOES NOT WORK!!!!
  $http.get('http://test.s17.sevacall.com/abhas/index.php').
    success(function(data, status, headers, config) {
      console.log(data);//debug
      $scope.categories = data;
    }).
    error(function(data, status, headers, config) {
      //log error
    });
  });
Any help would be greatly appreciated! Thanks in advance!
 
    