Adding $http to angularjs function