I am having trouble getting my knockout text observable to update with a computed or pureComputed ko function.
<li data-bind="css: { active: route().page === 'login'}">
<a href="#"><label data-bind="text: logOption"></label></a>
</li>
var vm = {
route: params.route,
logOption: ko.pureComputed(function() {
return userFunctions.isLoggedIn(session.user) ? "Log-out" : "Log-in";
})
}
return vm;
The binding is working, however it doesn't update when I log in or log out.
A previous knockout click binding would update whenever I clicked on the element, so I know that the userFunctions.isLoggedIn(sessions.user) does itself update properly depending on the log in / log out status.
I would like the text:logOption to update with "log in" or "log out" depending on the status, but it seems as if knockout is not observing the change in status of the userFunctions.isLoggedIn(sessions.user) within the computed variable?