Skip to content

Getting null error while running with cordova serve #409

@jwellner

Description

@jwellner

Just updated a test project to version v0.9.19 and noticed the following error running the project with "cordova serve ios"

TypeError: Cannot call method 'toLowerCase' of null
    at Object.ionic.Platform.is (http://localhost:8000/ios/www/js/ionic.js:1798:74)
    at Object.is (http://localhost:8000/ios/www/js/ionic-angular.js:448:33)
    at http://localhost:8000/ios/www/js/ionic-angular.js:1226:44
    at http://localhost:8000/ios/www/js/angular/angular.js:13560:28
    at completeOutstandingRequest (http://localhost:8000/ios/www/js/angular/angular.js:4105:10)
    at http://localhost:8000/ios/www/js/angular/angular.js:4412:7 

I think cordova serve is returning null on window.device.platform in the following code (line 70 platform.js)

    // Check if the platform is the one detected by cordova
    is: function(type) {
      if(window.device) {
        return window.device.platform === type || window.device.platform.toLowerCase() === type;
      }

      // A quick hack for 
      return navigator.userAgent.toLowerCase().indexOf(type.toLowerCase()) >= 0;
    }

Don't know if this is a cordova issue or should be fixed in the ionicframework.

$ cordova -v
3.3.1-0.1.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions