if( angular.isDefined( $scope.user.id ) ){ var data = ({ id : $scope.user.id }) ; }
Produces Error:
TypeError: Cannot read property 'id' of undefined
$scope.user is going to be undefined sometimes - it will only have a value if the user is logged in. I have tried typeOf, === 'undefined' and angular.isDefined / Undefined throughout my code and cannot find a solution that always works when checking a angular property that may be undefined or null.
Thanks for the help I am sure will follow.