jjzjj

something_undefined

全部标签

javascript - Angular 5 : ng build - -prod fails due to clean-css: Cannot read property 'line' of undefined

我的应用在Angular5.2.6下。ngserve一切正常,但是当运行ngbuild--prod时,它需要一段时间,然后才会失败。这些错误似乎与clean-css操作有关。错误跟踪:92%chunkassetoptimization/home/khalidvm/Desktop/Workspace/Front/frontend_v2/node_modules/clean-css/lib/reader/input-source-map-tracker.js:37if(originalPosition.line===null&&line>1&&selectorFallbacks>0){^T

javascript - window.open 在 chrome 扩展中返回 undefined

我有基于内容脚本的Chrome扩展程序。我通过内容脚本中的弹出窗口启动登录过程。我使用下面的代码打开一个弹出窗口,然后等到它关闭。但是,我从window.open方法中得到一个“undefined”。有人知道为什么会这样吗?loginwin在下面的代码中是undefined尽管弹出窗口可以正常打开指定的login_url。下面的代码是从我的内容脚本中调用的。varloginWin=window.open(login_url,'LoginWindow',"width=655,height=490");console.log(loginWin);//Checkevery100msifthe

javascript - "Cannot read property ' id ' of undefined"解析在工厂中声明的数组时

我正在构建一个基本应用程序(使用MEAN网络框架和节点webkit)以便更好地理解angularjs。这是我的notificationFactory.js的内容functionnotificationFactory(){varfooMessages=[{id:4,dismissable:true,name:"fooooBaaar",function:'',showInTopBar:false,priority:"high",icon:'fooIconBarBarBar',topBarIcon:'fooIconIconIcon'},{id:3,dismissable:true,name:

javascript - 为什么 'new Promise(...)' 返回 'undefined' ?

似乎如果在用于创建promise的函数中未引用“resolve”函数,则该promise未定义。在下面的代码中,...varcount=0;varlimit=3;//varthePromise;functiontimeout(_count){thePromise.resolve(_count);}functionsendMessage(){returnnewPromise(function(resolve,reject){if(++count>limit){reject({'LimitExceeded':count});}else{//Withthislineinplace,there

javascript - react-native 使用绝对路径?而不是从 '../../something/X' 导入 X?

我想知道为我的项目使用完整路径的最佳方式。例如,如果我正在导入一个组件,我不想执行importComponentfrom'../components/Component',而只是执行importComponentfrom'app/组件/组件';有人可以帮帮我吗? 最佳答案 要有绝对路径,我正在考虑您的package.json在根目录中。在里面,你的package.json添加一个新的属性名称,无论你想要什么值,即"name":"root"然后导入与该路线相关的所有路线importComponentfromroot/component

javascript - Google Maps API 加载失败 ("' google' is undefined") in IE8

当我加载http://maps.google.com/maps/api/js?sensor=false时在脚本标签中,我在Chrome、Safari、Firefox和IE9中一切正常。但是,当我在兼容模式中查看IE9(或者,有人告诉我,在IE8中)时,map不会加载并且“'google'未定义”"记录在控制台中。这是相关代码,触发错误的行用注释标识:TestMapvarlat=37.763154;varlon=-122.457941;varinitialZoom=17;varmapTypeId='CustomMap';varmapStyle=[{featureType:"landsca

javascript - 如何在 JavaScript 中没有大量 if 语句的情况下避免 "the property of undefined"错误?

我经常发现自己在处理像这样的深层物体:varx={y:{z:{a:true}}}代码中的某处:if(x.y.z.a===true){//dosomething}在某些情况下,任何x、y、z变量都可能未定义,在这种情况下,您会得到“无法读取未定义的属性*”可能的解决方案是:if(x&&x.y&&x.y.z&&x.y.z.a===true){//dosomething}jsfiddle:http://jsfiddle.net/EcFLk/2/但是有没有更简单/更快捷的方法呢?内联解决方案(不使用特殊功能)会很棒。谢谢。 最佳答案 不,你

javascript - uglify js错误意外 token eof "undefined"

所以我使用npminstalluglify-js安装了npm我运行的命令是:catfile1.jsfile2.js..fileN.js|uglifyjs-ofiles.min.js我得到这个错误:WARN:ERROR:Unexpectedtokeneof«undefined»,expectedpunc«,»[-:630,15]/usr/local/lib/node_modules/uglify-js/lib/parse.js:199thrownewJS_Parse_Error(message,line,col,pos);^ErroratnewJS_Parse_Error(/usr/lo

javascript - if 语句导致 TypeError : Cannont call unchain of undefined

我在我的Handlebars模板中使用了if语句。if语句有效,但是当您尝试更改路由时,它会导致UncaughtTypeError:Cannotcallmethod'unchain'ofundefined。我在下面的jsbin中重现了错误演示:http://emberjs.jsbin.com/UnUVorUn/9代码:http://emberjs.jsbin.com/UnUVorUn/9/edit 最佳答案 你的问题发生是因为你的IsLink以大写字母开头,有一个bug在Handlebars模板中使用时,已在1.3.0中修复。但是如

javascript - ie8 respond.js 'undefined' 为空或不是对象

我正在使用respond.js(该库的+1)我得到了对象的以下功能并出错:translate=function(styles,href,media){//hereIgot'undefined'errorinIE8varqs=styles.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi),ql=qs&&qs.length||0;//trytogetCSSpathhref=href.substring(0,href.lastIndexOf("/"));varrepUrls=function(css){returncss.replace(/(u