http://plnkr.co/edit/yhQQZxTxB8ZVFysqO6lP?p=preview
在AppComponent加载之前,如何确保我的AuthService得到解决?
//main entry point
import {bootstrap} from '@angular/platform-browser-dynamic';
import {Http,HTTP_PROVIDERS} from '@angular/http';
import {App} from './app';
import {AuthService} from './auth.service';
import {provide, enableProdMode, APP_INITIALIZER} from '@angular/core';
bootstrap(App, [HTTP_PROVIDERS,
provide("isLoggedIn", { useFactory: (auth:AuthService) => () => auth.login(), deps:[HTTP_PROVIDERS], multi: true }),
])
.catch(err => console.error(err));
Run Code Online (Sandbox Code Playgroud) 我正在使用Angular2 RC4版本和webpack dev服务器.我无法成功加载我的应用程序.在浏览器控制台上,它会抛出404并且无法使用webpack加载AppComponent模板文件.如果我使用lite-server,这是有效的
app.component.ts片段
@Component({
moduleId:module.id,
selector: 'body',
templateUrl: 'app.component.html',
})
Run Code Online (Sandbox Code Playgroud)
webpack.config.js片段
module:{
loaders:[
{test:/\.ts$/, loader:'ts', exclude: /node_modules/},
{test:/\.html$/, loader:'html' },
],
},
Run Code Online (Sandbox Code Playgroud)
错误 browser_adapter.js?0526:84 错误:未捕获(在承诺中):无法加载/app.component.html
我在控制台上看到此警告消息.我正在使用新的angular 2路由器.我错过了什么或者我必须做些什么来修复这个警告?
'DashboardComponent' not found in precompile array.
To ensure all components referred to by the RouterConfig are compiled, you must add 'DashboardComponent' to the 'precompile' array of your application component.
This will be required in a future release of the router.
Run Code Online (Sandbox Code Playgroud) 我在Angular 6应用中遇到以下错误。其实已经很久了,我正在尝试将旧的Angular 4应用程序升级到Angular 6。
WARNING in Circular dependency detected:
src/app/resources/index.ts ->
src/app/resources/models/filters/sowSearch.model.ts ->
src/app/shared/services/index.ts ->
src/app/shared/services/rest/http.interceptor.ts ->
src/app/resources/index.ts
Run Code Online (Sandbox Code Playgroud)
请告知问题或需要更多信息。