[英]Angular 2/4 not work correctly in first load
I have error when using router.navigate in angular 4, when route to other page, this page is not load correctly after refresh page. 在angular 4中使用router.navigate时出现错误,当路由到其他页面时,刷新页面后该页面无法正确加载。
I'm using angular2-color-picker 我正在使用angular2-color-picker
First time load page, color box is just text. 第一次加载页面时,颜色框只是文本。
And after refresh, it had background color. 刷新后,它具有背景色。
Any help is appreciate.
任何帮助表示赞赏。
Add to your app.module in providers 在提供商中添加到您的app.module
import { LocationStrategy, HashLocationStrategy } from '@angular/common';
@NgModule({
...
providers: [
{
provide: LocationStrategy,
useClass: HashLocationStrategy
}]
})
export class AppModule {
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.