草庐IT

is_active

全部标签

javascript - Angular - TypeError : XX is not a function

也许我缺少某种属性,但我正在关注这个project我在我的Controller中收到此错误。TypeError:loginService.signinisnotafunction这是我的controller.jsangular.module('appcontrollers',[]).controller('LoginController',['$rootScope','$scope','$http','$location','$localStorage','loginService',function($rootScope,$scope,$http,loginService){$sco

javascript - 错误 : [ng:areq] Argument 'MyCtrl' is not a function, 未定义

我是Angularjs的新手,我正在学习教程,但我在标题中遇到了错误。HTML代码:IDNameSurnameHouseAddressLocalityContactContact2Contact3ReplyEdit{{person.ID}}{{person.Name}}{{person.Surname}}{{person.House}}{{person.Address}}//DefiningaAngularmodulevarmyApp=angular.module('myApp',[]);//DefiningaAngularControllermyApp.controller('MyC

javascript - Uncaught ReferenceError : app is not defined in Angularjs

我遇到了这个错误。我查看了之前发布的答案,但仍然遇到同样的问题。index.htmlVizavoo应用程序.js(function(){varapp=angular.module('customersApp',['ngRoute']);app.config(['$routeProvider',function($routeProvider){$routeProvider.when('/login',{title:'Login',controller:'loginController',templateUrl:'app/views/loginuser.html'}).when('/log

javascript - 未捕获的类型错误 : undefined is not a promise

我得到了错误UncaughtTypeError:undefinedisnotapromiseconstp=Promise((resolve,reject)=>{resolve('ok')})p.then(resp=>console.log(resp))https://jsbin.com/daluquxira/edit?js,console,output上面的代码有什么问题? 最佳答案 您需要实例化Promise。在这种情况下:constp=newPromise((resolve,reject)=>{resolve('ok')})p.

javascript - jQuery ajax :error runs even if the response is OK 200

我有一个表单,它通过AJAX提交一个表单,其中:remote=>true。查看服务器日志和FireBug,我得到响应200OK,它以以下形式返回JSON:{"email":"test@test.com"}然后我有这两个处理程序:$('#new_invitation').bind("ajax:success",function(event,data,status,xhr){alert('test');});$('#new_invitation').bind("ajax:error",function(){alert('error');});即使我返回200OK,触发的也是错误处理程序。我

javascript - Uncaught ReferenceError : stopme is not defined (anonymous function)

我一直在我的控制台中看到这个非破坏性异常:UncaughtReferenceError:stopmeisnotdefined(匿名函数)在我的任何文件中都没有调用名为stopme的变量,在控制台中进行了全面搜索。我有多个:setInterval(function(){updateMetrics();},1000);调用我的代码,每当其中一个失败时,它就会显示在控制台中。我也不知道这是否是默认行为,但我也注意到每次我使用以下方法设置新间隔时:varintervalId=setInterval(function(){},1000);intervalId是非顺序的,如:console.log

javascript - setTimeOut 是未捕获的 ReferenceError : setTimeOut is not defined

关闭。这个问题是notreproducibleorwascausedbytypos.它目前不接受答案。这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topic在这里,这个问题的解决方式不太可能帮助future的读者。关闭8年前。Improvethisquestion首先,我是javascript的新手,我在setTimeOut中遇到了问题......这是我的脚本代码.......$('#navullia').hover(function(){$(this).next("div").slideDown("fast").siblings("div").slideU

javascript - {active : "yes"} and {"active": "yes"}? 有什么区别

我使用FireBug测试了这两种情况,结果看起来非常相似:>>>varx={"active":"yes"}>>>x.active"yes">>>varx={active:"yes"}>>>x.active"yes"但我很确定这两者之间存在一些差异,甚至可能是与性能相关的差异。底线-我想知道{active:"yes"}和{"active":"yes"}之间是否有区别。 最佳答案 两者都有效。但是,有些关键字不能使用,例如delete,因此为了避免将它们用引号引起来,这样它们就不会被ECMAScript解析器逐字处理,而是被明确指定为字

javascript - 渐进式 Web 应用程序 : How to detect and handle when connection is up again

使用PWA,我们可以在离线模式下处理设备连接断开的情况。但是我们如何检测固定网络连接并自动重新加载/重新激活应用程序? 最佳答案 您可以监控offlineandonlineevents,这是widelysupported.此外,您可以通过尝试从目标服务器URL获取HEAD来测试连接性://Testthisbyrunningthecodesnippetbelowandthen//usethe"Offline"checkboxinDevToolsNetworkpanelwindow.addEventListener('online',h

javascript - jQuery event.target is_a_child_of(元素)

给定element,一个包含JavaScript对象/DOM元素的变量,我如何确定event.target是否是element中的一个元素>还是不是?function(event){//assumethatvarelementexistsinthisscopeif(event.target==a_child_of(element))//dosomething}如果element是myDiv,则发生在内部div或输入上的事件,或可能存在于myDiv中的任何其他元素应该使语句评估为真。我想象我可以使用递归函数构建子元素数组,然后检查event.target是否在数组中,但我想先看看是否有更