草庐IT

token-based-authentication-with-n

全部标签

javascript - Angular 5 : Lazy Loading is not working properly with ng build - -prod with Angular-CLI 1. 7.x

我在:Angular:5.2.6AngularCLI:1.7.x我的应用程序下有这个路由文件(我有一些延迟加载模块):consthomeRoutes:Routes=[{path:'home',component:HomeComponent,children:[....{path:'admin',loadChildren:'app/home/admin/admin.module#AdminModule',canActivate:[AuthGuardAdmin]},]},];@NgModule({imports:[CommonModule,RouterModule.forChild(hom

javascript - 是什么导致 TypeError : Expected `input` to be a `Function` or `Object` issue with gtoken and pify?

我正在尝试将FirebaseRemoteConfig集成到我的Cordova应用程序中,以强制用户在拥有最低版本时进行更新,但导入包会导致错误。它不能在代码中,因为错误是在代码运行之前抛出的,只是通过导入包。TypeError:Expected`input`tobea`Function`or`Object`,got`undefined`at./node_modules/gtoken/node_modules/pify/index.js.module.exports(index.js:45)atObject../node_modules/gtoken/build/src/index.js

javascript - 在 javascript 中包含 base64 gzipped 样式表/图像?

我知道您可以在javascript文件中以base64格式存储css和图像以及其他文件类型。然而,它们相当大......并且压缩后,它们缩小了很多,即使base64编码的开销约为33%。非gzip压缩,图片为data:image/gif;base64,data:image/jpeg,data:image/png,css为data:text/css;base64。那么,我可以/应该使用什么mime类型来包含gzip压缩的css或图像数据URI?(或者如果gzip+base64不能工作,我可以做任何其他压缩来减小字符串的大小,同时仍然将数据存储在javascript中吗?)..编辑..我认

javascript - 将动画 GIF 编码为 Base64

我一直在寻找一种方法来将动画GIF从给定的URL编码为base64,而无需使用jquery等外部库(如果绝对必要,我会使用它)。我有foundresults将静态图像编码为base64,但它们都使用canvas,而canvas.toDataURL()只会编码动画GIF的单帧。有没有一种方法可以在不使用canvas的情况下将动画GIF(或与此相关的任何图像)编码为base64? 最佳答案 是的,您可以使用FileReader.readAsDataURL()(examplebasedonMDNwebdocs):functionprevi

javascript - 深入理解 : How code structure affects the content of date arrays created with loops

背景说明我问了一个关于使用循环定义日期数组的问题。数组是根据名为“dateinterval”的已声明变量定义的。我设计代码的方式导致了与另一个循环相关的错误消息,另一个用户为我提供了另一个循环来解决这个问题。既然我已经仔细比较了两种不同的解决方案,我就是不明白为什么它们不会产生相同的结果。我的代码我开发了以下代码来定义UTC格式的日期数组。然而,结果是自1970年1月1日00:00:00以来以毫秒为单位的日期数组。换句话说,一个数字。for(vari=0;i正确的解决方案下面的代码是另一位用户提供给我的正确代码(再次感谢您!)此代码定义了一组UTC日期。for(vari=0;i我不明白

javascript - 如果 src 是 base64 字符串,如何获取新创建的 Image() 的文件大小?

如果此图像的src是base64数据图像,我如何获取新创建的newImage()的字节大小?我有这样的coffeescript代码:#Thisstringisreceivedaftersomeoriginalimagepreprocessingbase64String="data:image/jpeg;base64......"newImageObj=newImage()newImageObj.src=base64StringnewImageObj.onload=->console.log"Resizedimagewidthis"+this.widthconsole.log"Newfi

javascript - Bluebird promise 链 : 'Catch' with Result

为了让这个问题对尽可能多的人有用,除了我在下面使用Node+Express的Bluebirdpromise库这一事实之外,我将排除我的具体实现细节。所以,假设我有以下链(其中P返回一个promise,res是ExpressHTTP响应对象):P().then(function(){//donothingifallwentwell(fornow)//weonlycareifthereisanerror}).catch(function(error){res.status(500).send("Anerroroccurred");}).then(function(){returnP();}

javascript - Wordpress - 未捕获的语法错误 : Unexpected token <

我将脚本放入子主题中......functionchild_theme_scripts(){wp_enqueue_script('script-name',get_template_directory_uri().'/js/custom-child.js',array(),'1.0.0',true);}add_action('wp_enqueue_scripts','child_theme_scripts');但是我在控制台中收到一个UncaughtSyntaxError:Unexpectedtoken值得一提的是,当我的custom-child.js中没有任何内容或者我只使用一个简单

javascript - ngRepeat with ngAnimate 在我的元素上设置 "data-ng-animate= 2"

我不知道为什么ngRepeat在我的元素上添加了data-ng-animate=2属性。为什么会这样?我这样写:我明白了:谢谢! 最佳答案 正如您在thesourcecodehere中看到的那样data-ng-animate属性用于跟踪动画的状态:varPRE_DIGEST_STATE=1;varRUNNING_STATE=2;所以基本上它只是在元素本身上存储它自己的动画状态。在您的情况下(2)它正在运行。如果您跟随NG_ANIMATE_ATTR_NAME浏览该文件,您可以跟随它添加、更新和最终从元素中删除。

javascript - Firebase Firestore : orderBy combined with where causes error "Operation was rejected"

我正在查看FirebaseCloudFirestoredocumentation对于orderBy。当我尝试执行此操作时varfacultyQuery=facultyRef.where("department","==","CoreTeacher").orderBy('bb_last_name','desc');我得到错误:Error:Firestore:Operationwasrejectedbecausethesystemisnotinastaterequiredfortheoperation`sexecution.(firestore/failed-precondition).这