Javascript 例外情况:TypeError:undefined不是Ionic 2中的对象(正在计算';pipe.constructor';)?
我的Ionic 2应用程序在chrome浏览器上运行良好,它提供了预期的输出。但当它在模拟器或浏览器上运行时给出以下错误 以下是我正在使用的代码:Javascript 例外情况:TypeError:undefined不是Ionic 2中的对象(正在计算';pipe.constructor';)?,javascript,pipe,angular,remote-debugging,ionic2,Javascript,Pipe,Angular,Remote Debugging,Ionic2,我的Ionic 2应用程序在chrome浏览器上运行良好,它提供了预期的输出。但当它在模拟器或浏览器上运行时给出以下错误 以下是我正在使用的代码: <label class="time">{{appointment.DateSent | date:"HH"}}:{{ appointment.DateSent| date:"mm"}}</label> <label class="month">{{appointment.DateSent| date:"MMM"}
<label class="time">{{appointment.DateSent | date:"HH"}}:{{ appointment.DateSent| date:"mm"}}</label>
<label class="month">{{appointment.DateSent| date:"MMM"}}</label>
<label class="day">{{appointment.DateSent| date:"dd"}}</label>
<label class="year">{{appointment.DateSent| date:"yyyy"}}</label>
所有的数据管道在Chrome浏览器中正常工作,没有错误,但在模拟器或设备上出现以下异常(取自Safari模拟器调试)
编辑:
Index.html
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<title>Ionic</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!--<meta http-equiv="Content-Security-Policy" content="img-src 'self' data:; default-src 'self' http://XX.XX.XX.XX:8084/mypp/">-->
<!--<meta http-equiv="Content-Security-Policy" content="default-src *; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src 'self' 'unsafe-inline' *">-->
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<link rel="stylesheet" href="build/css/font-awesome.min.css">
<link ios-href="build/css/app.ios.css" rel="stylesheet">
<link md-href="build/css/app.md.css" rel="stylesheet">
</head>
<body>
<ion-app></ion-app>
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
<script src="node_modules/systemjs/dist/system-polyfills.js"></script>
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<script src="cordova.js"></script>
<script src="build/js/app.bundle.js"></script>
</body>
</html>
离子的
您应该加载polyfills(Chrome可以在没有它们的情况下运行):
您应该加载polyfills(Chrome可以在没有它们的情况下运行):
Sasxa的回答帮助我解决了这个问题。虽然我试图指定路径,但它似乎找不到它的资源。以下资源帮助我得到了答案。正如Sasxa指出的,Safari需要Intl polyfill 我试着用NPM安装它,但Bower不起作用,最后我决定使用CDN location,因为它对我有用
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Intl.~locale.en"></script>
Sasxa的回答帮助我解决了这个问题。虽然我试图指定路径,但它似乎找不到它的资源。以下资源帮助我得到了答案。正如Sasxa指出的,Safari需要Intl polyfill 我试着用NPM安装它,但Bower不起作用,最后我决定使用CDN location,因为它对我有用
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Intl.~locale.en"></script>
Hi Sasxa,感谢您的帮助!但它仍然给出了错误。我用我的index.html文件更新了这个问题,如果你看到了任何错误,请告诉我。从代码上看不出来。你能不捆绑构建吗?这样就无法判断错误可能在哪里…是的,我可以不包括捆绑包而构建,实际设备也无法正常工作我使用的是Ionic 2,如何在src中检查我的路径是否正确?它也会给出类似这样的错误,原始异常:ReferenceError:找不到变量:IntlHi Sasxa,感谢您的帮助!但它仍然给出了错误。我用我的index.html文件更新了这个问题,如果你看到了任何错误,请告诉我。从代码上看不出来。你能不捆绑构建吗?这样就无法判断错误可能在哪里…是的,我可以不包括捆绑包而构建,实际设备也无法正常工作我使用的是Ionic 2,如何在src中检查我的路径是否正确?它也会给出类似这样的错误,原始异常:ReferenceError:找不到变量:Intl
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Intl.~locale.en"></script>