我想集成angular2-odata库。我使用Angular2 - 类构造函数不能被调用没有'新'
@Injectable()
class MyODataConfig extends ODataConfiguration{
baseUrl="http://localhost:54872/odata/";
}
bootstrap(app,[
//some of my other providers etc.
provide(ODataConfiguration, {useClass:MyODataConfig}),
ODataServiceFactory,
]
问题是,当我尝试注入ODataServiceFactory我得到的是以下错误:ODataConfiguration的实例化过程中的错误:
例外! (ClassService - > ODataServiceFactory - > ODataConfiguration)。 ORIGINAL EXCEPTION:TypeError:类的构造函数ODataConfiguration不能被调用没有'新'
我GOOGLE了它,似乎有一些问题,而试图注入扩展类,但我无法找到解决方案。任何帮助,将不胜感激。
我认为你的类需要一个构造函数调用'super();' – Harangue
感谢您的建议,但我试图添加构造函数(){ super(); },例外情况相同。 –
你可以发布你的'ODataServiceFactory'实现吗? –