使用了 url article/
以下程式碼
export class ArticleResolver implements Resolve{
id:any
constructor(private http:Http,private route:ActivatedRoute ){
}
resolve():Observable<any>{
console.log(this.route.snapshot.params.id)
return this.http.get(`${Website}api/v1/article/1`)
.map(res=>{
console.log(res.json())
return res.json()
})
}
但是這個this.route.snapshot.params.id卻是undefine
ps:我用forchild,lazyloading module