Template empty variable


#1

Hi everyone, i have to ask a thing because i didn’t find anywhere.
In ionic templates the syntax to access a variable is {{myvariable.property}} and that’s ok.
But how can i check if variable is empty? Is there a if condition or empty/length function to check it?

Thanks.


#2

you could use basic javascript and try:

if( $scope.myvariable.property ) {//stuff here}

#3

thanks! i solved moving the logic to the angularjs controller instead in a way to keep the template clean. Thanks anyway for the help, it could be precious in the future.