nCo*_*ore 8 javascript angular2-routing angular
有href
没有办法没有重定向回angular2中的根?因为我有这个<a href="" (click)="modal.open()"></a>
代码打开一个模态,但它将我重定向回我的主页.
我知道它因为routeConfig有角度,但有没有办法说旁路呢?
{ path: '', component: LoginComponent, pathMatch: 'full'},
Run Code Online (Sandbox Code Playgroud)
请注意,如果完全删除href有效,则可能没有检查w3c验证.
小智 9
href="javascript:;"
Content-Security-Policy
当不允许内联脚本时(script-src: 'self';
例如)(https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src),单击链接后将产生错误。
您可以在单击时使用带有 event.preventDefault() 的空 href。
<a href="" (click)="$event.preventDefault()">Link</a>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4285 次 |
最近记录: |