第一种
html
<!-- sss?aid=1 -->
<ul>
<li *ngFor="let item of newsList; let key = index;">
<a [routerLink]="['/newsdetail']" [queryParams]="{aid:item.id}">{
{
key}}--{
{
item.name}}</a>
</li>
</ul>
<button type="button" (click)="gotoDetail($event)" tag='1'>新闻详情</button>
ts
import {
Component, OnInit } from '@angular/core';
import {
Router } from '@angular/router';
@Component({
selector: 'app-news',
templateUrl: './news.component.html',
styleUrls: ['./news.component.less']
})
export class NewsComponent implements OnInit {
public newsList: any[] = [{
id