在以前的版本中,我提供了AuthHttp作为Fallows:
return bootstrap(<any>App, [
// These are dependencies of our App
...FORM_PROVIDERS,
...HTTP_PROVIDERS,
...ROUTER_PROVIDERS,
...ENV_PROVIDERS,
provide(AuthHttp, {
useFactory: (http) => {
return new AuthHttp(new AuthConfig({
tokenName: 'jwt'
}), http);
},
deps: [Http]
}),
provide(APP_BASE_HREF, {useValue : '/' })
]).catch(err => console.error(err));但在RC4+中,provide已被弃用,并且即将发出弃用警告。那么如何将这些更改为与更高版本兼容。
发布于 2016-07-26 15:29:07
提供更改为传递对象而不是函数:
return bootstrap(<any>App, [
// These are dependencies of our App
...FORM_PROVIDERS,
...HTTP_PROVIDERS,
...ROUTER_PROVIDERS,
...ENV_PROVIDERS,
{
provide: AuthHttp,
useFactory: (http) => {
return new AuthHttp(new AuthConfig({
tokenName: 'jwt'
}), http);
},
deps: [Http]
},
{
provide: APP_BASE_HREF,
useValue : '/'
}
]).catch(err => console.error(err));https://stackoverflow.com/questions/38583552
复制相似问题