angular 瀏覽器id的獲取和設定

2021-09-29 14:01:27 字數 403 閱讀 8718

1、

,import from '@angular/router';

import from '@angular/common'

constructor( private route: activatedroute, private location: location ) {}

const id =this.route.snapshot.parammap.get('id');

route.snapshot是乙個路由資訊的靜態快照,抓取自元件剛剛建立完畢之後。

parammap是乙個從 url 中提取的路由引數值的字典。"id"對應的值就是要獲取的英雄的id

獲取瀏覽器的模式

document.compatmode 檢視瀏覽器的模式 標準模式 css1compat 主流瀏覽器 怪異模式 backcompat document.compatmode用來判斷當前瀏覽器採用的渲染方式。當document.compatmode等於backcompat時,瀏覽器客戶區寬度是docu...

JS獲取瀏覽器的高度

ie中 document.body.clientwidth body物件寬度 document.body.clientheight body物件高度 document.documentelement.clientwidth 可見區域寬度 document.documentelement.client...

獲取預設瀏覽器的方法

獲取系統當前預設瀏覽器 win xp hkey classes root http shell open command 鍵值下 default 預設值是 c program files internet explorer iexplore.exe nohome win7 hkey current ...