1. 程式人生 > >angular 通過路由獲取ID

angular 通過路由獲取ID

img router activated struct private rom mage params lis

    constructor(
        private dataService: TestListsService,
        private route: ActivatedRoute,
      ) {
      // 通過路由獲取ID
      console.log(route);
      this.id = this.route.params.value[‘id‘];
    }
import { ActivatedRoute } from ‘@angular/router‘;

技術分享圖片

angular 通過路由獲取ID