9

I'm busy testing my app on a browser and on my device with ionic view. I want to know if there is a way to have a browser type console.log displayed on my device with a label or something text based?

Nikola
  • 14,888
  • 21
  • 101
  • 165

1 Answers1

13

Well, sure you can make a <div> in your app at the bottom for example and log all the errors in there. So, everything you usually use with console.log() you would now append to this <div>.

However, I strongly suggest against that since it seems totally unpractical. What I would do in your case is run the application on your actual device with ionic run with these two options (as explained in the official documentation):

With live reload enabled, an app's console logs can also be printed to the terminal/command prompt by including the --consolelogs or -c option. Additionally, the development server's request logs can be printed out using --serverlogs or -s options.

SandroMarques
  • 6,070
  • 1
  • 41
  • 46
Nikola
  • 14,888
  • 21
  • 101
  • 165
  • I will give it a try the `--consolelogs` does it work on mac terminal as well? @Nikola –  Jul 10 '15 at 09:09
  • 1
    The downside to this is that you can't really view log outputs of API response callbacks in the terminal. It will just show up as `[object Object]`. – Graham S. Aug 21 '15 at 16:48
  • 2
    @user1852651 you can use for JSON.stringify() that here's an example http://stackoverflow.com/a/4162803/1783311 – 0x1ad2 Dec 15 '15 at 10:58