search

Home  >  Q&A  >  body text

angular.js - How to plan backend interface calls and encapsulate them into individual Services? ~

How to plan better to facilitate future maintenance and get full commission service? Or should we create a value to store the names of interface methods and parameters~

天蓬老师天蓬老师2875 days ago659

reply all(2)I'll reply

  • 迷茫

    迷茫2017-05-15 17:14:18

    My approach is modular, using namespaces and dependency injection
    For example, the request interface for orders is placed in order.service.js. This granularity can be adjusted to personal preferences

    Put the method called by the interface in the service, and then call this method in the controller

    If the call of this interface involves other modules, move the calling method of this interface to the next level

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-15 17:14:18

    Let me show you the scaffolding I uploaded on github

    https://github.com/WuWeiSen/a...

    reply
    0
  • Cancelreply