I upgraded my large app from 1.4 to 1.6 recently. Ever since the upgraded, some extremely helpful debug/error messages aren't showing.
For example, if I forget an injection, there's no error message, however the app won't load.
If I try to do any large changes, my app won't load because of some angular-centric issue, but I normally won't be able to find the issue since there's no console message.
Edit
I'm also not getting error messages for circular dependencies. The app just won't load in this case, either.
We finally figured this out ourselves. Thought I'd come back and share.
We had to modify a config on the main module. Here's the code example. Give it a try. Unless you figured out something else.
var myApp = angular.module('myApp');
myApp.config(['$qProvider', function ($qProvider) {
$qProvider.errorOnUnhandledRejections(true);
}]);
Related
i have little problem with my code:
https://github.com/burnpiro/angular-blog
live version is available on http://erdem.pl/#/
Problem is that after deploying it on my server routing doesn't work. ui-router not even trying to load template or controller into ui-view. Application starts and configs are fired (tried with console.log). Even resolve option in home state is fired (PostService). But somehow it cannot load template. If i access template manually:
erdem.pl/components/home/home.html
it is there. The same with controller. If anyone have any ideas please let me know. It happened after deploy. Before that on my local machine it seems to work fine but now after getting project again and deploying it on my local it has the same error.
There is no JS errors or any network errors.
Thanks for help,
I'm not completely sure, but I think the issue is with the host you've set in your config.js file? This should be pointed to the public link for wherever your api lives. Should it be "http://erdem.pl"?
I've also noticed that Restangular doesn't seem to be sending your requests. I see that the execution gets into the RequestInterceptor, but I don't see them in the Network tab of my developer tools. This means that your promises from your resolve properties on your states will never be resolved. Your states are configured to wait for these resolve requests to resolve before initializing the controller and loading the template.
EDIT: I think I found the issue!
Looks like Restangular is only compatible with Lodash 3.10, anything after that causes compatibility issues. Downgrade to 3.10 and hopefully it works for you!
I have a pretty basic Angular app.
When I try to run it in the browser, the page is blank. But no errors show up in the Chrome console.
Could this have been turned off somehow?
UPDATE
I found the problem to be that I gave angular.module(...) a variable name, but forgot to update the chained calls with the variable. So it looked like this.
var app = angular.module(....);
.config(..);
However, I'm still wondering why I didn't see that error in Chrome
I am trying to create the polling app described in this tutorial here.
I have step 2 finished, and I am about to start step 3(once my application is running properly) which is to incorporate the DB portion. My application is not behaving like the application listed in the tutorial currently though.
I have scanned my code numerous times and debugged it and still cant seem to catch what is throwing it off. When I run the application it runs fine, but none of my partials are being displayed only what is provided in the inital index.html view, so it is simply showing my blank navbar.
I have provided my git repository. If anyone has a moment and can take a look at it. Thank you for your time in advance.
Some of the key things I fixed in my pull request:
You need to include angular-route.js as a separate file now, and have your module depend on ngRoute.
You were missing quotes around the first $routeProvider in the following line:
.config(['$routeProvider',function($routeProvider){
You now need to register controllers using a name (string) with the module, rather than using global functions.
app.controller('ControllerName', function ($scope, ...) { ... });
You also forgot to actually reference a few of the JS files you need in index.html using <script> tags.
There are other small things, but see the PR for the full details. I also changed the way bower components are done.
We're having strange, sporadic JavaScript error messages in our production log files (JavaScript errors are logged in the backend):
Uncaught Error: [$compile:tpload] http://errors.angularjs.org/1.2.16/$compile/tpload?p0=modules%2Fsome%2valid-directive-path.tpl.html
The error occurs only with directives. I'm not able to reproduce the errors locally. The templateUrl for the directives are all valid.
The only possible scenario that came to my mind was if the user presses the cancel/stop button in the browser while the page is loading (then i'm able to reproduce the error).
Does anyone have another idea or explanation? Or even a solution :-)
Cheers
Michael
We resolved the issue like this:
Since we are caching our HTML templates with $templateCache using the grunt ngTemplate plugin (https://www.npmjs.com/package/grunt-angular-templates) we do not have the above issues anymore.
Out of interest I was able to recreate this issue. By adding logging to angular I established that when the template load fails it does so with a status of 0 which made me think that the request was actually cancelled. This theory was backed up by the fact that we see no server side errors.
If I emulate a device that cannot support html5 routing and then add an arbitrary query string to the end of the route, it causes an infinite digest loop and in the end the whole page reloads a few times. This in turn was causing the outstanding template requests to be cancelled leading to exactly the errors I was seeing in the logs.
So, for me at least, this is really nothing to do with the loading of the templates, it's just an angular bug (which hopefully is going to be fixed in angular 1.3.8)
I have small trouble with angularjs and internet explorer9. It look like, that angularjs is not loading correctly. If I starting ie with my application, nothing will work, but if I start the development tools of ie9 and refresh the page, my application will work and everything is loading and ready to use.
I have no idea, what happen and how to solve this issue. I using angularJs Version 1.1.5. Big thanks!
Update & Resolved
My problem was, that I had everywhere console.log (..). On FF or Chrome, everything works, but with II9, something happens, that ie stop after the statement console.log(...); After removing console.log(..) from my JavaScript, my application also works on IE7/8/9.
But ??
But I would ask why IE has so much problems with console.log?
I run in to the same issue and what fixed it was creating window console in the parent controller before using it. You can add the following code and try.
window.console = window.console || {};
window.console.log = window.console.log || function() {};
Use $log service. It will be injected in your controllers.
https://docs.angularjs.org/api/ng/service/$log
Are you making a call to console.log in your code?
If yes, this will not be available in IE unless you open the dev tools.