debugging Angular routing code

57 views
Skip to first unread message

Larry Martell

unread,
Mar 15, 2016, 4:39:34 PM3/15/16
to AngularJS
I have an app written in Qt and via a mechanism that I am not really clear on some Angular JS code gets run when requests are sent to certain URLs that contain a #. From what I was able to learn this somehow goes to some Angular code that intercepts the request with $routeProvider and does something. Not sure how that all hangs together, but it probably have something to do with nginx.

How can I debug that Angular code? There's no browser involved so I can't use the standard tools I would use there. Even just printing some variable and/or process state would help, but how can I do that in this scenario?

Larry Martell

unread,
Mar 17, 2016, 8:21:55 PM3/17/16
to AngularJS
On Tuesday, March 15, 2016 at 4:39:34 PM UTC-4, Larry Martell wrote:
I have an app written in Qt and via a mechanism that I am not really clear on some Angular JS code gets run when requests are sent to certain URLs that contain a #. From what I was able to learn this somehow goes to some Angular code that intercepts the request with $routeProvider and does something. Not sure how that all hangs together, but it probably have something to do with nginx.

How can I debug that Angular code? There's no browser involved so I can't use the standard tools I would use there. Even just printing some variable and/or process state would help, but how can I do that in this scenario?

Answering my own question for anyone searching for the same thing.

Qt has a QWebInspector class that give you all the familiar tools you'd get using the Chrome web developer tools. It was very easy to use. I did this:

  ui->webView->setUrl(url); 
  QWebPage *page = ui->webView->page();
  page->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
  QWebInspector *inspector = new QWebInspector();
  inspector->setPage(page);
  inspector->show();
And this gave me an error console, JS debugger, and other goodies. 
Reply all
Reply to author
Forward
0 new messages