Я хочу решить, как использовать $scope.time
для моего HTML.Я хочу показать в пользовательском интерфейсе время последнего http-запроса, но выдает ошибку.Я не могу использовать $scope
.
У меня есть эти коды:
module.factory('timestamp', [function ($scope) {
var time = {
request: function (config) {
$scope.time = new Date().getTime(); //wanted to show in UI realtime
return config;
}
//,response: function (response) {
// response.config.responseTimestamp = new Date().getTime();
// return response;
//}
};
return time;}];
Конфиг:
module.config(function ($httpProvider) {
$httpProvider.interceptors.push('timestamp');}