这行代码不让我睡觉:
$scope.search = function (login) {
github.getUser(login).then(onUserResponse, onError);
};
加载它:
angular.module('lol')
.factory('github', github);
返回两个功能:
return {
getUser: getUser,
getRepos: getRepos
};
有了这个信号:
var github = function ($http) {
MainController消费:
var MainCtrl = function ($scope, github, $filter, $timeout, $intervel, $anchorScroll, $location) {
并没有注入它的依赖关系:
MainCtrl.$inject = ['$scope', '$filter', '$interval', '$timeout', '$anchorScroll', '$location'];
将应用程序加载如下:
angular.module('lol', [])
.controller('MainCtrl', MainCtrl);
所有这一切都抛出:TypeError: __tracer.traceFunCall(...) is not a function