Differences between chrome with ionic serve and phone with ionic run


#1

Hi,
I’m new with Ionic, but I know something about Angular. I have a problem when I try to use my own directives and deploy in my Phone. All the tags that I create with a directive run ok in my computer browser, but when i deploy in my phone, the application not render all the code that I have in directives.
My directives are similar to the function ng-include. For example, one of my directives is:

app.directive(‘headerGlobal’, function() {
return {
restrict: ‘E’,
templateUrl: ‘…/templates/includes/headerGlobal.html’
};
});

and I call with the tag .
It’s a very simple directive, and it render in my PC browser, but not in my phone.

Can you help me?

Thanks,

Kevin


#2

Hi Kevin,

Can you look at the console logs that are in platforms/ios/cordova/console.log or platforms/android/cordova/console.log to see what errors are being logged? That file should show you the logs captured about the app.

One thing to note, on the phone or emulator files are served differently than if you use ionic serve. On your machine with the serve command, files are sent over the http:// protocol, where on the phone it is actually using the file:// protocol. There might be an issue with how you’re referencing the files that could cause the file not to be found over file://.


#3

Thanks gnomeontherun,

I have 2 errors:

  1. Failed to load resource: the server responded with a status of 404 (Not Found) “http://localhost:8100/cordova.js
  2. Uncaught TypeError: Cannot read property ‘push’ of undefined “firebug-lite.js:30905”

But firebug is a javascript debug tool for browsers, and i didn’t add this to my project.
The first error I always see, from the beginning.

Can you help me?

Thanks