title: Using Resources to store data in json file in Angular
body: <p>Folks I have a form on my website who's data I want to store in a json file. </p>
  
  <p>Here is the code for the form:</p>
  
  <pre><code> &lt;form&gt;
      &lt;input ng-model="obj.firstname"&gt;
      &lt;input ng-model="obj.lastname"&gt;     
      &lt;button ng-click="storedata()"&gt;Click here to store data&lt;/button&gt;        
  &lt;/form&gt;
  </code></pre>
  
  <p>My Angular code is as below:</p>
  
  <pre><code>var myApp = angular.module('app', ['ui.bootstrap.dialog','ngResource']);
  
  myApp.controller('TestCtrl', function($scope,$dialog,TestResource) { 
   $scope.obj = {};
   $scope.obj.firstname = "Mahatma";
   $scope.obj.lastname = "Gandhi";
  
   $scope.storedata = function() {
      console.log("Storing Data now");
      TestResource.save($scope.obj);
      console.log("Data should have been stored");
   }
  });
  
  
  myApp.factory('TestResource', ['$resource', function($resource) {
    return $resource('test.json', {}, {} );
  }]);
  </code></pre>
  
  <p>The problem is that the data does not get stored. Am I missing something here ? 
  Here is a plunkr : <a href="http://plnkr.co/edit/gist:3662702" rel="nofollow">http://plnkr.co/edit/gist:3662702</a></p>