Update viewmodel.js

added check for observable