关于教程里service模块 doRequest方法的疑惑
var myServiceApp = angular.module("MyServiceApp", []); myServiceApp.factory('userListService', ['$http', function($http) { var doRequest = function(username, path) { console.log(path); return $http({ method: 'GET', url: 'users.json' }); } return { userList: function(username) { return doRequest(username, 'userList'); } }; } ]); myServiceApp.controller('ServiceController', ['$scope', '$timeout', 'userListService', function($scope, $timeout, userListService) { var timeout; $scope.$watch('username', function(newUserName) { console.log(newUserName); if (newUserName) { if (timeout) { $timeout.cancel(timeout); } timeout = $timeout(function() { userListService.userList(newUserName) .success(function(data, status) { $scope.users = data; }); }, 350); } }); } ]); //...
能告诉我doRequest这个方法里面的path有什么作用么,userList方法里面的‘userList有什么作用