angular.js - How to plan backend interface calls and encapsulate them into individual Services? ~
天蓬老师
天蓬老师 2017-05-15 17:12:18
0
2
647

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~

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(2)
迷茫

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

大家讲道理

Let me show you the scaffolding I uploaded on github

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template