Saturday, June 1, 2024
 Popular · Latest · Hot · Upcoming
47
rated 0 times [  52] [ 5]  / answers: 1 / hits: 18844  / 8 Years ago, tue, january 3, 2017, 12:00:00

I am trying to get a date value. Whenever the the checkbox is unchecked and the date picker is invisible I am getting the error that : 'Cannot read property 'NTLI' of undefined'. if the check box is checked and the date picker is visible everything works fine



<md-checkbox ng-model=user.NTLI layout=row ng-disabled=userForm.$invalid>
NTLI
</md-checkbox>
<div ng-show=user.NTLI>
<fieldset class=standard>
<legend>NTLI</legend>
<md-input-container>
<label>Efective date</label>
<md-datepicker ng-model=user.efectiveDateNTLI></md-datepicker>
</md-input-container>
</fieldset>
</div>




var efDate = '';
if ($scope.user.NTLI != undefined)
{
efDate = $scope.user.efectiveDateNTLI
}

More From » angularjs

 Answers
-6

You need to have user defined,



$scope.user ={};
if ($scope.user.NTLI != undefined)
{
efDate = $scope.user.efectiveDateNTLI
}

[#59482] Saturday, December 31, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
andreguym

Total Points: 125
Total Questions: 112
Total Answers: 103

Location: Wallis and Futuna
Member since Tue, Mar 30, 2021
3 Years ago
;