title: How to consume api in the server side with $resource in angularjs
body: <p>I try using <code>$resource</code> in angularjs to consume the api in the server side. Indeed I make it work like this.</p>
  
  <pre><code>  app.factory("LevelSettings", ["$resource", function($resource) {
      return $resource("/api/level_setting/list");
    }])
    .factory("LevelSetting", ["$resource", function($resource) {
      return $resource("/api/level_setting/get");
    }])
    .factory("DeleteLevelSettings", ["$resource", function($resource) {
      return $resource("/api/level_setting/delete");
    }])
    .factory("LevelSettingOperation", ["$resource", function($resource) {
      return $resource("/api/level_setting/add_edit");
    }])
  </code></pre>
  
  <p>But I think there can be better way to achieve this. I know some better practice like creating restful api in the server side, but how to consume this restful api in my angularjs client? Or I can just create a service to collect the apis to consume same model like this <code>level_setting</code>?</p>