为什么承诺的回调是反模式的?
app.controller('tokenCtrl', function($scope, tokenService) { tokenService.getTokens(function callbackFn(tokens) { $scope.tokens = tokens; });});app.factory('tokenService', function($http) { var getTokens = function(callbackFn) { $http.get('/api/tokens').then (function onFulfilled(response) { callbackFn(response.data); }); }; return { getTokens: getTokens };});
$http
.then
aluckdog
子衿沉夜
手掌心
相关分类