I think you want
<h4>User Name<span data-bind="text:$root.dashboardData.userName"></span></h4>
or alternately
<h4>User Name<span data-bind="text:$parent.dashboardData.userName"></span></h4>
Given that userName
and hospitalList
are peers in your DashboardViewModel
, and you're referencing hospitalList
as dashboardData.hospitalList
, that tells me that your root view model has an instance of DashboardViewModel
on it as dashboardData
. So assuming that you're bound to the root view model at the beginning of your quoted HTML, as you're using dashboardData.hospitalList
to get at the list, I assume it would be dashboardData.userName
to get at the username (from the root). So, $root.dashboardData.userName
. Or since we know dashboardData
is a child of the parent context, $parent.dashboardData.userName
.