在Angular 1.x中,您可以定義如下常量:angular.module('mainApp.config', []).constant('API_ENDPOINT', 'http://127.0.0.1:6666/api/')Angular2(帶有TypeScript)的等效功能是什么?我只是不想在所有服務中一遍又一遍地重復API基本URL。
- 3 回答
- 0 關注
- 631 瀏覽
添加回答
舉報
0/150
提交
取消