Why i get strange errors in console when AngularJS module loads? - javascript

I use Angularjs 1.2.21 in my project.
I download and install angular-route.min.js file
Here is main module defenition:
angular.module('dashboard', ['ngRoute','layers'])
.config(function () {});
In console I get this 2 errors:
Uncaught TypeError: Cannot read property 'w' of null
at initialize.setMap (OpenLayers.js:625)
at initialize.addLayer (OpenLayers.js:182)
at initialize.addLayers (OpenLayers.js:182)
at initialize (OpenLayers.js:177)
at mapApp.js:205
at HTMLDocument.<anonymous> (mapApp.js:221)
at fire (jquery-1.8.3.js:974)
at Object.fireWith [as resolveWith] (jquery-1.8.3.js:1084)
at Function.ready (jquery-1.8.3.js:406)
at HTMLDocument.DOMContentLoaded (jquery-1.8.3.js:83)
And second error is this:
angular.min.js:92 TypeError: Cannot read property 'charAt' of undefined
at Tb.$$parse (angular.min.js:86)
at angular.min.js:90
at k.$eval (angular.min.js:111)
at k.$digest (angular.min.js:108)
at angular.min.js:90
at angular.min.js:38
at q (angular.min.js:7)
at g (angular.min.js:38)
at angular.min.js:31
at q (angular.min.js:7)
When I remove ngRoute from dependency injection everything works fine:
angular.module('dashboard', ['layers'])
.config(function () {});
Any idea why I get errors above?

Related

Uncaught TypeError: Cannot read property 'bind' of undefined in backend.js

I got this Error in my Angular 8 project while loading http://localhost:4200
Uncaught TypeError: Cannot read property 'bind' of undefined
at new t (backend.js:31)
at Object.<anonymous> (backend.js:31)
at Object.<anonymous> (backend.js:31)
at r (backend.js:1)
at Object.<anonymous> (backend.js:31)
at r (backend.js:1)
at Object.<anonymous> (backend.js:31)
at r (backend.js:1)
at Object.<anonymous> (backend.js:31)
at r (backend.js:1)
this.clearImmediate=t.clearImmediate.bind(t);else{this.nextHandle=1,this.tasksByHandle={},this.currentlyRunningATask=!1,this.canUseProcessNextTick()
Make sure
t.clearImmediateis defined before calling .bind()method on it.
Either your own code, or one of your project's dependencies, must be using clearImmediate, which is a MSIE-only thing.
https://developer.mozilla.org/en-US/docs/Web/API/Window/clearImmediate

angularjs - Ionic/Angular1 Tlantic/cdv-socket-plugin error

TypeError: Cannot read property 'isConnected' of null
at PosCommunicator.isConnected (app.all.min.js:2926)
at app.all.min.js:3298
at Scope.$emit (libs.all.min.js:56256)
at Object.emit (libs.all.min.js:83720)
at Object.transition (libs.all.min.js:83550)
at libs.all.min.js:85379
at libs.all.min.js:83428
at Object.render (libs.all.min.js:83517)
at Object.init (libs.all.min.js:83427)
at Object.self.render (libs.all.min.js:85373)
Uncaught TypeError: Cannot read property 'plugins' of undefined
at app.all.min.js:40
at Array.<anonymous> (libs.all.min.js:81844)
at onPlatformReady (libs.all.min.js:28102)
at onWindowLoad (libs.all.min.js:28083)
I installed Tlantic/cdv-socket-plugin
but socketplugin method cannot loaded ('isConnected' of null)
Anyone can help me to solve this problem.
https://github.com/Tlantic/cdv-socket-plugin

TypeError: jQuery(...).placeholder is not a function

I use the avada theme, version 3.6.1. and runnig WP 4.5.5.
Some calenders weren't showing on the website and the error was: Syntax error, unrecognized expression: a[href*=#]:not([href
I changed the main.js [href*=#] into [href*="#"]
Now Im getting this:
Uncaught TypeError: jQuery(...).placeholder is not a function
at HTMLDocument. (4b8c4.js:1792)
at i (26ef1.js:5)
at Object.fireWith [as resolveWith] (26ef1.js:5)
at Function.ready (26ef1.js:5)
at HTMLDocument.K (26ef1.js:5)
If you wanna update the placeholder attribute, you need to use attr method.
$('[href*="#"]').attr('placeholder', 'hoge');

App works locally, errors in Heroku. Is it because of my async = false tag?

I took a template that was written with various plug ins and started to convert it to React. Converting the existing JavaScript files to work in React is beyond my ability, so what I did was:
componentDidMount(){
var loadScripts = [
'./vendor/jquery/jquery.js',
'./vendor/bootstrap/js/bootstrap.min.js',
'./js/classie.js','./js/cbpAnimatedHeader.js',
'./vendor/jquery.easing/jquery.easing.min.js',
'./vendor/owl-carousel/owl.carousel.js',
'./vendor/magnific-popup/jquery.magnific-popup.min.js',
'./vendor/formstone/core.js',
'./vendor/formstone/transition.js',
'./vendor/formstone/background.js',
'./vendor/mixitup/jquery.mixitup.js',
'./vendor/wow/wow.min.js',
'./js/contact_me.js',
'./js/jqBootstrapValidation.js',
'./js/vitality.js'];
loadScripts.forEach(function(src) {
var script = document.createElement('script');
script.src = src;
script.async = false;
document.head.appendChild(script);
});
}
and it works perfect locally. When I pushed to heroku, I am getting many errors. The errors lead me to believe the files are loading asynchronously. Does Heroku allow the async = false tag?
Here are the errors:
Uncaught TypeError: Cannot read property 'scrollTop' of undefined
at e (background.js:3)
at HTMLDocument.c (background.js:3)
at b (core.js:3)
at Object.<anonymous> (core.js:3)
at Object.<anonymous> (jquery.js:3366)
at fire (jquery.js:3187)
at Object.add [as done] (jquery.js:3246)
at Array.<anonymous> (jquery.js:3365)
at Function.each (jquery.js:365)
at Object.<anonymous> (jquery.js:3361)
contact_me.js:3 Uncaught TypeError: $(...).jqBootstrapValidation is not a function
at HTMLDocument.<anonymous> (contact_me.js:3)
at fire (jquery.js:3187)
at Object.add [as done] (jquery.js:3246)
at jQuery.fn.init.jQuery.fn.ready (jquery.js:3496)
at jQuery.fn.init (jquery.js:2927)
at jQuery (jquery.js:75)
at contact_me.js:1
background.js:3 Uncaught TypeError: Cannot read property 'container' of undefined
at jQuery.fn.init.g (background.js:3)
at jQuery.fn.init.e (core.js:3)
at jQuery.fn.init.i (core.js:3)
at vitality.js:109
at vitality.js:135

How to get more verbose error info in Angular?

I get only this error text in Chrome. No any additional info:
What does it mean? What happened? Is there a way to tell Angular or Chrome to show more verbose error information?
Here is my app.js file. Nothing else is included:
'use strict';
// Declare app level module which depends on filters, and services
var vsApp = angular.module('vsApp', [
'ngRoute',
'vsApp.filters',
'vsApp.services',
'vsApp.directives',
'vsApp.controllers'
]);
vsApp.config(["$routeProvider"], function($routeProvider) {
$routeProvider.when('/registration', {templateUrl: 'partials/reg.html', controller: 'regCtrl'});
$routeProvider.when('/login', {templateUrl: 'partials/login.html', controller: 'loginCtrl'});
$routeProvider.otherwise({redirectTo: '/'});
});
vsApp.controller("regCtrl", function() {});
vsApp.controller("loginCtrl", function() {});
ng-app attribute inclusion:
<!DOCTYPE html>
<html ng-app="vsApp">
My <head> tag:
<script id="angularScript" src="/bower_components/angular/angular.js"></script>
<script src="/bower_components/angular-route/angular-route.js"></script>
<script src="/assets/js/app.js"></script>
UPD:
Protractor brought more info:
Message:
UnknownError: unknown error: [$injector:modulerr] Failed to instantiate module vsApp due to:
Error: [ng:areq] Argument 'fn' is not a function, got string
http://errors.angularjs.org/1.3.0-build.2795+sha.222d473/ng/areq?p0=fn&p1=not%20a%20function%2C%20got%20string
at http://localhost:3000/bower_components/angular/angular.js:78:12
at assertArg (http://localhost:3000/bower_components/angular/angular.js:1583:11)
at assertArgFn (http://localhost:3000/bower_components/angular/angular.js:1593:3)
at annotate (http://localhost:3000/bower_components/angular/angular.js:3318:5)
at Object.invoke (http://localhost:3000/bower_components/angular/angular.js:3986:21)
at runInvokeQueue (http://localhost:3000/bower_components/angular/angular.js:3915:35)
at http://localhost:3000/bower_components/angular/angular.js:3924:11
at Array.forEach (native)
at forEach (http://localhost:3000/bower_components/angular/angular.js:320:11)
at loadModules (http://localhost:3000/bower_components/angular/angular.js:3905:5)
I don't know how to get more verbose error messages. I don't think it is even possible. However, you seem to have a at least a syntax error:
vsApp.config(["$routeProvider", function($routeProvider) {
/* notice the [ ] */
}]);
because you're using annotated injection of dependencies, just like in the documentation: https://docs.angularjs.org/guide/providers#providers_provider-recipe
myApp.config(["unicornLauncherProvider", function(unicornLauncherProvider) {
unicornLauncherProvider.useTinfoilShielding(true);
}]);
In any case I tried to reproduce the error message you got but I only obtain useful error messages. see http://jsfiddle.net/CE6j9/1/
Uncaught Error: [$injector:modulerr] Failed to instantiate module vsApp due to:
Error: [ng:areq] Argument 'fn' is not a function, got string
http://errors.angularjs.org/1.2.1/ng/areq?p0=fn&p1=not%20a%20function%2C%20got%20string
at http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.js:78:12
at assertArg (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.js:1346:11)
at assertArgFn (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.js:1356:3)
at annotate (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.js:2926:5)
at Object.invoke (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.js:3587:21)
at http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.js:3534:37
at Array.forEach (native)
at forEach (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.js:300:11)
at loadModules (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.js:3521:5)
at createInjector (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.js:3461:11)
http://errors.angularjs.org/1.2.1/$injector/modulerr?p0=vsApp&p1=Error%3A%2…cloudflare.com%2Fajax%2Flibs%2Fangular.js%2F1.2.1%2Fangular.js%3A3461%3A11)
http://errors.angularjs.org/1.2.1/$injector/modulerr?p0=vsApp&p1=Error%3A%2…cloudflare.com%2Fajax%2Flibs%2Fangular.js%2F1.2.1%2Fangular.js%3A3461%3A11) angular.js:78
(anonymous function) angular.js:78
(anonymous function) angular.js:3555
forEach angular.js:300
loadModules angular.js:3521
createInjector angular.js:3461
doBootstrap angular.js:1282
bootstrap angular.js:1297
angularInit angular.js:1246
(anonymous function) angular.js:20126
trigger angular.js:2298
(anonymous function) angular.js:2562
forEach angular.js:300
eventHandler
maybe you had something else interfering?
I got the lower half of errors (with line numberS) when I clicked in the arrow. maybe you have the wrong settings in chrome?

Categories