title: Knockout: how can I pass a model to a javascript object literal?
body: <p>please go through the link: <a href="http://jsfiddle.net/nn0mfe48/1/" rel="nofollow noreferrer">http://jsfiddle.net/nn0mfe48/1/</a></p>
  
  <p>Here i am able to use knockout WITH binding when i use object literal, but when i change it to function same code doesn't work.</p>
  
  <p>Works:     </p>
  
  <pre><code>var profileModel =  {
      first: ko.observable("Bob"),
      last: ko.observable("Smith"),
  };
  </code></pre>
  
  <p>Doesn't work: </p>
  
  <pre><code>var  profileModel = function() {
      this.firstname= ko.observable("Bob");
      last: ko.observable("Smith");
  };
  </code></pre>
  
  <p>what do  i need to change in code to make it work.
  My need of hour is to pass knockout viewmodel object to viewmodel and bind the value dynamically instead of hard coding the values.</p>
  
  <p>i had gone through the link : <a href="https://stackoverflow.com/questions/9589419/difference-between-knockout-view-models-declared-as-object-literals-vs-functions">Difference between knockout View Models declared as object literals vs functions</a></p>
  
  <p>but couldn't understand how can make use in my case.
  hope i explained clearly and understandable. any help in this regard is appreciated.thanks in advance.</p>