简体   繁体   English

为什么console.log给出的错误不是函数类型?

[英]why is console.log is giving an error that is not a function type?

I am suddenly getting the below error . 我突然得到以下错误。 I havent changed anything in this controller recently to get this error. 我最近没有更改此控制器中的任何内容以获取此错误。

Has anyone seen a similar issue before or know how to fix this? 有没有人见过类似的问题或知道如何解决这个问题? My browsers havent changed or updated, and it was working fine until yesterday. 我的浏览器没有更改或更新,直到昨天才正常工作。

Chrome TypeError: console.log is not a function Chrome TypeError:console.log不是函数

IE TypeError: Function expected IE TypeError:预期的功能

 CreateBankCtrl.$inject = ['CommonService'];

  function CreateBankCtrl(CommonService) {
        var vm = this;
        vm.apiAlerts = [];
        console.log("Creating the controller");
}

It could be your browser, or some cache, try to clear it and open fresh browser. 它可能是您的浏览器或某些缓存,尝试清除它并打开新的浏览器。 It works for me. 这个对我有用。 I hope this will help you out. 我希望这会帮助你。

Finally, I found the issue, 最后,我发现了这个问题,

I had inadvertently introduced an equals to operation ("=") 我无意中引入了等于操作(“=”)

console.log = ("fetched user permissions " + $localStorage.userPermissions);

this had overridden the log function. 这已经覆盖了日志功能。 I have lint setup with strict mode on. 我有严格模式的lint设置。 But the above was not caught. 但上面没有抓住。 Can lint be configured to capture such issues? 可以将lint配置为捕获此类问题吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM