Pregunta

i'm simply trying printing out a param value that is FALSE, and it prints out "false" as plain text, quite unbelievable... any clue ?

   $rootScope.session = {
                "username" : $window.localStorage['user_username'] || false,
                "id_user" : $window.localStorage['user_id'] || false,
                "token" : $window.localStorage['user_session_token']
            }
    //in view
    <div>{{session.username}}</div>
¿Fue útil?

Solución

Try to use ng-if directive:

<div ng-if="session.username">{{session.username}}</div>

Otros consejos

Angular.js probably calls toString() on the printed values.

false.toString();

The above results in string "false".

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top