App is getting crashed :length of undefined

after a button click my app is get crashed. screen get white and everything start from first point again.
ionic info


global packages:

    @ionic/cli-utils : 1.5.0
    Cordova CLI      : 6.5.0
    Ionic CLI        : 3.5.0

local packages:

    @ionic/app-scripts              : 1.3.12
    @ionic/cli-plugin-cordova       : 1.4.1
    @ionic/cli-plugin-ionic-angular : 1.3.2
    Cordova Platforms               : android 6.1.2
    Ionic Framework                 : ionic-angular 3.4.1

System:

    Node       : v7.10.0
    OS         : Windows 10
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 5.3.0

plugins

 "dependencies": {
        "@angular/common": "4.1.3",
        "@angular/compiler": "4.1.3",
        "@angular/compiler-cli": "4.1.3",
        "@angular/core": "4.1.3",
        "@angular/forms": "4.1.3",
        "@angular/http": "4.1.3",
        "@angular/platform-browser": "4.1.3",
        "@angular/platform-browser-dynamic": "4.1.3",
        "@ionic-native/background-mode": "^3.14.0",
        "@ionic-native/camera": "^3.14.0",
        "@ionic-native/core": "3.12.1",
        "@ionic-native/diagnostic": "^3.14.0",
        "@ionic-native/file": "^3.14.0",
         "@ionic-native/geolocation": "^4.1.0",
        "@ionic-native/keyboard": "^3.14.0",
        "@ionic-native/location-accuracy": "^3.14.0",
        "@ionic-native/push": "^3.14.0",
        "@ionic-native/splash-screen": "3.12.1",
        "@ionic-native/sqlite": "^3.14.0",
        "@ionic-native/status-bar": "3.12.1",
        "@ionic-native/transfer": "^3.14.0",
        "@ionic/cloud-angular": "^0.12.0",
        "@ionic/storage": "2.0.1",
        "cordova-plugin-console": "1.0.5",
        "cordova-plugin-device": "1.1.4",
        "cordova-plugin-splashscreen": "~4.0.1",
        "cordova-plugin-statusbar": "2.2.2",
        "cordova-plugin-whitelist": "1.3.1",
        "ionic-angular": "3.4.1",
        "ionic-plugin-keyboard": "~2.2.1",
        "ionicons": "3.0.0",
        "rxjs": "5.4.0",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.12"
    },
    "devDependencies": {
        "@angular/tsc-wrapped": "^4.3.1",
        "@ionic/app-scripts": "^1.3.12",
        "@ionic/cli-plugin-cordova": "1.4.1",
        "@ionic/cli-plugin-ionic-angular": "1.3.2",
        "typescript": "2.3.3"
    },

it gives error => cannot read property length of undefined

Maybe that is because you are trying to get the length of something that doesn’t exists or it’s wrongly defined. Make sure it is an array so you can get the property length.

1 Like

ya .i was trying to get the length of undefined. problem was that app was getting crashed ,every thing get started again, i was not able to capture the issue. .Now i solved that .thanks