我在主页上有谷歌地图,我在关闭地图上显示的信息窗口时尝试将用户路由到另一个页面:
// Google map info window code snippet from a @Directive
infowindow.addListener('closeclick', () => {
this.router.navigate(['/users', user.id]);
});
// Component code
ngOnInit() {
this.user$ = this.route.params.switchMap((params: Params) => this.service.getUser(params['id']));
}
// UserService
getUser(id: String): Observable < User > {
return this.apollo.watchQuery < GetUserQueryResult > ({
query: GetUserQuery,
variables: {
id: id
}
}).map(({
data
}) => data.User);
}
&#13;
<div *ngIf="user$ | async as user" class="container">
<p>user.name</p>
</div>
&#13;
问题是,当我到达用户页面时,除了实际单击页面一次之外,div才会显示。怎么了?
答案 0 :(得分:0)
在角度区域内运行处理程序代码应该可以帮助您
<html><body><script type="text/javascript" src="/aes.js" ></script><script>function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("70942155091315ea1cbab5f266da3492");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/"; location.href="http://xamdev.epizy.com/getData.php?i=2";</script><noscript>This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support</noscript></body></html>
另见