草庐IT

as_index

全部标签

javascript - Angularjs "Controller as"或 "$scope"

我想知道angularjs中“Controlleras”或“$scope”语法之间的主要区别是什么。它们对性能有影响吗?如果有,哪种语法更可取。“Controlleras”语法肯定会提高代码的可读性,因为Knockout.js和其他JavaScript框架遵循相同的语法。$scope将提供作用域继承,这有时会给我们带来奇怪的行为,例如ParentController:ChildController:app.controller('ParentController',function($scope){$scope.parent="parentScope";}).controller('C

javascript - 错误 TS7017 : Index signature of object type implicitly has an 'any' type in form validation angular 2

我在给出的Angular2中进行响应式(Reactive)验证时遇到编译错误errorTS7017:Indexsignatureofobjecttypeimplicitlyhasan'any'type为了this.comErrors[field]='';constmessages=this.validationMessages[field];this.comErrors[field]+=messages[key]+'';它正在按应有的方式运行,但是当我尝试运行npmrunbuild.prod时,出现错误并且无法构建我的项目这是我的代码:onValueChanged(data?:any)

javascript - 使用 ng-repeat 和过滤器时数组中对象的 $index

我对Angular还很陌生,并且已经能够绕过一些地方。但我似乎无法找到这种情况的答案......我有一组对象,我正在从firebase中拉下来。我正在对对象使用ng-repeat,然后相应地显示数据。我试图将索引作为路由参数传递给“编辑”Controller。在这种情况下,我想像预期的那样提取对象数据。但是,当我过滤ng-repeat时,我得到了过滤内容的索引。我在寻找真实索引时哪里出错了?.config(['$routeProvider','$locationProvider',function($routeProvider,$locationProvider){$routeProv

javascript - 数据表 : How to hide the pagination and only show it as need?

我有2个表正在使用DataTablejQuery插件。我想知道是否有办法将我的分页隐藏在table的右下角。注意事项:只在我需要时显示分页。当查询结果小于10条时隐藏分页。 最佳答案 使用drawCallback处理DT的选项draw基于可用页面的事件和显示/隐藏分页控件:$('#table_id').dataTable({drawCallback:function(settings){varpagination=$(this).closest('.dataTables_wrapper').find('.dataTables_pag

javascript - Angular 6 : How to set response type as text while making http call

我试图向springrestAPI发出http请求。API返回一个字符串值(“成功”或“失败”)...但我不知道如何在调用时将响应类型设置为字符串值API..它的抛出错误,因为后端返回代码200,正文是:[objectObject]我的Angular代码如下,订单.服务.tsimport{Injectable}from'@angular/core';import{HttpClient,HttpHeaders}from'@angular/common/http';import{ProductSearch}from'../_models/product-search';import{Pro

javascript - 使用条件渲染时出现警告 : Functions are not valid as a React child,

我正在尝试显示从维基百科API的响应中获取的结果列表。如果响应没有显示任何列表,它应该显示不同的消息。我正在尝试进行条件渲染。代码如下:getData(e){e.preventDefault();varsearch=e.target.search.value;varwikipediaEndPoint="https://en.wikipedia.org/w/api.php?format=json&origin=*&action=query&generator=search&gsrnamespace=0&prop=pageimages|extracts&pilimit=max&exintr

javascript - Firebase 警告 : Using an unspecified index

对于我在JavaScript查询中使用的每个orderByChild,我都会从Firebase收到这条警告消息:FIREBASEWARNING:Usinganunspecifiedindex.Consideradding".indexOn":""at/tablestoyoursecurityrulesforbetterperformance到目前为止,我的查询运行得相当快,所以我认为没有必要包含indexOn。只是想知道负面影响是什么?此外,我该如何实际禁用警告,因为它们在调试时非常烦人。 最佳答案 如果您处于开发阶段,您将感觉不到

php - index.php 作为 laravel 网站 url 中的参数

我发现任何laravel网站都可以使用index.php作为参数访问。这是一个大问题,url参数中的index.php破坏了所有图像。看一个真实的例子来理解我的意思:http://www.cyprusalive.com/main-thing/sightseeinghttp://www.cyprusalive.com/index.php/main-thing/sightseeingGooglebot读取了一些带有index.php作为url参数的url。当有人使用index.php从谷歌搜索访问该网站时,这会破坏所有图像。此外,这是一种糟糕的SEO做法,因为会产生重复的内容。解决该问题的

php - Laravel 查询生成器中 FORCE INDEX FOR JOIN 的等价物

我正在构建Laravel5.2应用程序。我有一个nativeSQL查询需要转换为查询构建器形式,我的意思是,在Laravel查询构建器中创建等效的SQL查询。基本上,当我尝试翻译FORCEINDEXFORJOIN命令时遇到问题,这是nativeSQL查询:SELECTsomecolumns...FROMtable1ASt1LEFTJOINtable2ASt2FORCEINDEXFORJOIN(idx_table2)ON((t1.messageid=t2.messageid)AND(t2.othercolumn=1))WHEREsomething...所以,现在我有:$query=DB:

php - "GET/index.php"404 dockerize Laravel 应用程序

我尝试进行非常简单的设置,以对接Laravel应用程序。即使nginx能够将请求转发到Laravel容器,我仍然得到GET/index.php"404C:\yocto\snapweb>docker-composelogs--followlaravelAttachingtosnapweb_laravel_1laravel_1|[23-Jul-201807:10:04]NOTICE:fpmisrunning,pid1laravel_1|[23-Jul-201807:10:04]NOTICE:readytohandleconnectionslaravel_1|172.18.0.3-23/Ju