App works when running from browser but not from emulator


#1

Hello, my problem is that the app only works in the browser (using ionic serve). When doing an ionic emulate ios it just shows a blue bar on the top of the screen and nothing else. Let me show you.

Desktop:

Simulator:

I’m very new to ionic and hybrid mobile app development in general. I’ve only done native ios before. Can you tell me what’s wrong. If the emulator gives any errors how can I view them?

Update It works correctly if I run on the simulator with --livereload


#2

Try using chrome://inspect and checking the console for any errors upon running.


#3

i enabled remote debugging on safary and have a bunch of errors like this for every view I added to my project. What is wrong?

Failed to load resource: The requested URL was not found on this server. file:///app/components/login/login.html

Edit

Ok, I found the error. When specifying the routes to the views I added a / to the beginning. That was the problem. It was

templateUrl: '/app/components/login/login.html'

instead of

templateUrl: 'app/components/login/login.html'

#4

Try this new browser MERCURY WEB BROWSER . U can find it here http://ios.ratedfreeware.com/software/mercury-web-browser-with-powerful-adblock-extension/ . Don’t worry this site is reliable ( no viruses, no bugs). For me it more convenient.


#5

My next problem is that it doesn’t work on a real device. It looks like this:


#6

Try enabling console and server logs when running the emulator:

ionic emulate [ios|android] --livereload --consolelogs --serverlogs

This way you can check your terminal for errors to make debugging easier.


#7

Ok, everything looks ok, this time the problem was that I didn’t know filenames (css and js) are case sensitive when adding them to index.html.