title: AngularJS ngInit with Date
body: <p>I'm coding in .NET MVC and would like to pass a stored DateTime object to the front-end as an initial value for a Date object in a controller.</p>
  
  <p>Here's what I've tried:</p>
  
  <pre><code>ng-init="params.datetime = new Date()"
  </code></pre>
  
  <p>This doesn't seem to work, and I'm getting a syntax error.</p>
  
  <p>How can I pass in a Date object as an initial property for a scope variable?</p>
  
  <p><a href="http://jsfiddle.net/xX8LJ/">http://jsfiddle.net/xX8LJ/</a></p>
  
  <p>UPDATE</p>
  
  <p>I forgot to include the Razor code in my code sample.</p>
  
  <pre><code>ng-init="params.datetime = new Date('@Model.DepartureTime.ToString("s")')"
  </code></pre>