在Angular我正在构建以下模块......
(function () {
//TimeTrack Manual
var app = angular.module('TimeTrack', ['ngRoute', 'toaster']);
app.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when('/login', { templateUrl: 'Assets/App/Views/Login.html', controller: 'LoginController' })
.when('/calendar', { templateUrl: 'Assets/App/Views/Calendar.html', controller: 'CalendarController' })
.otherwise({ redirectTo: 'login' });
}]);
}());
我正试图从不同的模块中加入烤面包机服务......
angular.module('toaster', ['ngAnimate'])
.service('toaster', ['$rootScope', function ($rootScope) {
this.pop = function (type, title, body, timeout, bodyOutputType, clickHandler) {
this.toast = {
type: type,
title: title,
body: body,
timeout: timeout,
bodyOutputType: bodyOutputType,
clickHandler: clickHandler
};
$rootScope.$broadcast('toaster-newToast');
};
this.clear = function () {
$rootScope.$broadcast('toaster-clearToasts');
};
}])...
然后我得到了一个试图包含烤面包机模块烤面包机服务的控制器...
(function() {
var app = angular.module('TimeTrack');
var LoginController = function ($scope, $http, $location, toaster) {
};
app.controller('LoginController', ['$scope', '$http', '$location', 'toaster', LoginController]);
}());
但是当这个运行时,我收到一个错误,说“未捕获的对象”。谁能看到我在这里做错了什么?
由于