title: I cant define a new object in javascript and push it into array using inputs without overriding it or causing a error
body: <p>I want to add a post to a new object then push that object into an array of all posts.</p>
  
  <p>When i try to do this i get a duplication error if i dont write post =  new {}
  But if i do then i get a TypeError: (intermediate value) is not a function</p>
  
  <p>If anyone can help this would be greatly appreciated. </p>
  
  <p>ps. Additional browny points for anyone who can tell me how to make the array persistant on page reload (/link me a artical)</p>
  
  <p>Javascript:</p>
  
  <pre><code>myApp.controller "PostController", ["$scope", ($scope) -&gt;
    $scope.posts = []
    # $scope.post = {}
    $scope.addpost = -&gt;
      $scope.post = new {}
      $scope.post.header = $scope.header
      $scope.pst.content = $scope.content
      $scope.posts.push $scope.post
  
    return
  ]
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div ng-controller="PostController"&gt;
      &lt;input type="text" ng-model="header" placeholder="Header"&gt;&lt;/input&gt;&lt;p&gt;
      &lt;input type="text" ng-model="content" placeholder="Content"&gt;&lt;/input&gt;&lt;br&gt;
      &lt;button class="btn btn-primary" ng-click="addpost()"&gt;
        Submit
      &lt;/button&gt;
      &lt;div ng-repeat="post in posts"&gt;
        &lt;hr&gt;
        &lt;h2&gt;{{post.header}}&lt;/h2&gt;&lt;br&gt;
        &lt;h4&gt;{{post.content}}&lt;/h4&gt;&lt;br&gt;
        &lt;hr&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>