javascript - Angular, ternary in ng-click -


i have ternary inside ng-click swap value between 'bookmarks' , 'none'. first click change bookmarks works great second 1 not. think have wrong in syntax or logic. here code:

ng-click="current = 'bookmarks' ? current = 'bookmarks' : current = 'none' " 

i print {{current}} on screen , change bookmarks once i've toggled that. appreciate help. thanks!

your ternary expression wrong.

bookmarks(string) evaluated true so, current assigned bookmarks. seems work first time. however, next clicks assigned bookmarks.

use following expression:

ng-click = "current = (current == 'bookmarks') ? 'none' : 'bookmarks'" 

Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Restarting Supervisor and effect on FlaskSocketIO -

android - Format a french phone number -