是否可以手动实例化 Http Service 而无需将其作为构造函数参数?
export class SimpleGridServer {
private http: Http;
constructor(public options: SimpleServerData) {
http = new Http(.../* Argument here */);
}
}
实例化这个类。
var grid = new SimpleGridServer({/* options */});
我想实例化这个类而不依赖于我的component
那个 import的 Http 服务SimpleGridServer
。如果这是可能的,那么这种情况的缺点是什么?