Skip to content Skip to sidebar Skip to footer

Cannot Read Property $scope.dropdownfield Of Null In Angularjs

I have a simple registration form page. The form page have a person_id field and drop down list name condition_code_1. Person_id field is mandatory field meanwhile the condition_co

Solution 1:

That's because data doesn't exist before you call $scope.create(), therefore is undefined, which means is not an object, which means it cannot have a property, thus javascript throws the error.

try:

var data = {};
$scope.create = function () {

    data.personId = $scope.person_id;
    data.conditionCode1 = $scope.specialCond.condCode1; 

    CondCodeSvc.create(data, function(res){
       jAlert('Create successfull');
    }, errSvc.errorHandler);                   
};

Post a Comment for "Cannot Read Property $scope.dropdownfield Of Null In Angularjs"