我正在主页上加载一些后端 api 数据 ngOnInit()
export class MyComponent{
homepagedata:any; // displayed on the html
ngOnInit() {
this.homepagedata=// calling service
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的路线
{
path: 'home',
component: HomeComponent,
children: [
{
path: 'dashboard/:userid', //
component: DashboardComponent,
},
]
}
Run Code Online (Sandbox Code Playgroud)
因此,当我导航到仪表板,然后再次导航到主页时,我的主页组件没有刷新,可能是因为ngOnInit()被调用了一次。ngOnit()每次导航到主页时如何调用它。我尝试过,ngAfterViewInit()但它也只调用了一次.
我在这里发现了一个类似的问题。但在这里它是在函数调用之后导航,这不是我的情况。我的情况中有很多子组件,我正在寻找一种适合所有人的解决方案。谢谢
我在弹性搜索中创建了一个索引,看起来像
{"amazingdocs":{"aliases":{},"mappings":{"properties":{"Adj Close":{"type":"text"},"Close":{"type":"text"},"Date":{"type":"text"},"High":{"type":"text"},"Low":{"type":"text"},"Open":{"type":"text"},"Volume":{"type":"text"}}},"settings":{"index":{"creation_date":"1563168811565","number_of_shards":"1","number_of_replicas":"1","uuid":"k2wCARIETvufWmrdkDOtyw","version":{"created":"7020099"},"provided_name":"amazingdocs"}}}}
Run Code Online (Sandbox Code Playgroud)
但是现在当我尝试使用 kibana 在其中插入文档时,出现以下错误
{
"error": {
"root_cause": [
{
"type": "parse_exception",
"reason": "unknown key [High] for create index"
}
],
"type": "parse_exception",
"reason": "unknown key [High] for create index"
},
"status": 400
}
Run Code Online (Sandbox Code Playgroud)
语法,我遵循的是
PUT /amazingdocs/
{
"Date": "1960-10-06",
"Open": "53.720001",
"High": "53.720001",
"Low": "53.720001",
"Close": "53.720001",
"Adj Close": "53.720001",
"Volume": "2510000"
}
Run Code Online (Sandbox Code Playgroud)
此外,当我尝试插入具有类似字段的批量数据时,出现以下错误
"{"took":66336,"errors":true,"items":[{"index":{"_index":"amazingdocs","_type":"_doc","_id":"O7o_9GsBcUaBu1lEWjja","status":400,"error":{"type":"mapper_parsing_exception","reason":"failed to parse","caused_by":{"type":"not_x_content_exception","reason":"Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"}}}}
Run Code Online (Sandbox Code Playgroud)