我正在尝试构建一个Angularjs应用程序,而我的控制器出现问题.
'use strict';
/* Controllers */
angular.module('myApp.controllers', []).
controller('AppCtrl', function ($scope, $http) {
}).
controller('indexCTRL', function ($scope) {
$http.get('/api/frettir').
success(function(data, status, headers, config) {
$scope.posts = data;
});
});
Run Code Online (Sandbox Code Playgroud)
但是当我运行它时会出现错误,说明$ http未定义.我能改进什么?
我有一个在数据库更新时触发的函数:
exports.eventAddedTrigger = functions
.region('europe-west6')
.firestore
.document('users/{user_id}/events/{event_id}')
.onCreate(async (snap, context) => {
const event = snap.data();
if (event) {
const { user_id, event_id } = context.params;
const queue = getFunctions().taskQueue('enrol');
const signupDate = DateTime.fromSeconds(event.signupDate.seconds).minus({minutes: 2});
const now = DateTime.local({zone: 'Europe/Zurich'})
let scheduleDelaySeconds = Math.floor(signupDate.diff(now, 'seconds').seconds);
if (scheduleDelaySeconds < 0) {
scheduleDelaySeconds = 10;
}
functions.logger.info(`Scheduling enrollment for ${signupDate.toISO()} in ${scheduleDelaySeconds} seconds`);
await queue.enqueue(
{ user_id, event_id },
{
scheduleDelaySeconds
}
)
}
});
Run Code Online (Sandbox Code Playgroud)
这个函数触发得很好,但是当涉及到入队时,我总是收到以下错误
Error: Queue does not exist
Run Code Online (Sandbox Code Playgroud)
无论我是在模拟中还是在生产中运行该函数。 …