if (typeof $scope.input.gps === 'undefined') {
$scope.msgBody = 'Location not found.';
} else {
$scope.msgBody = $scope.input.gps+' not found.';
}
flash.pop({title: 'Error', body: $scope.msgBody, type: 'error'});
Would there be an easier way to do this if statement and include it inside the flash.pop
There's nothing wrong with clear, easily maintained code even if it's a few characters more to type initially, it might save a lot of time and effort later.
Seems you need to set the value of $scope.msgBody, I don't think it's a good idea to do that in the assignment. Consider:
$scope.msgBody = typeof $scope.input.gps === 'undefined'? 'Location not found.' :
$scope.input.gps + ' not found.'
However, I don't think that's "easier".