角的时刻 - 无法读取的未定义的属性'UTC' [英] Angular-moment - cannot read property 'utc' of undefined

查看:172
本文介绍了角的时刻 - 无法读取的未定义的属性'UTC'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用角片刻的指令上午的时间去,但我得到了以下错误:

I am trying to use angular-moment's directive am-time-go but I get the following error:

TypeError: Cannot read property 'utc' of undefined

我用它在一个简单的控制器这样的(玉):

I use it in a simple controller like this (in jade):

    span(am-time-ago="myItem.date")

和我的日期做工精细,其格式如下:

And my dates work fine, their format is the following:

2014-10-29T23:31:23Z

我也试图配置我的模块:

I have also tried configuring my module:

myApp.constant('angularMomentConfig', {
    preprocess: 'utc',
    timezone: 'Europe/Berlin'
});

但没有任何工程。从哪里做这个问题干?

But nothing works. Where does this problem stem from?

非常感谢

推荐答案

显然,因为V2.4一刻不是一个全局对象更多,这就造成了未定义每次角时刻作出时刻的参考。

Apparently, since v2.4 moment is not a global object any more, which resulted in 'undefined' everytime angular-moment made a reference to moment.

我切换到2.3.1版,它就像一个魅力现在

I switch to v.2.3.1, it works like a charm now

这篇关于角的时刻 - 无法读取的未定义的属性'UTC'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆