📅  最后修改于: 2022-03-11 14:56:19.498000             🧑  作者: Mango
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'my-app';
prtl = {
"name": "Stock Market",
"id": 10,
"category": {
"id": "2",
"name": "Football"
}
};
categories = [
{
"id": "1",
"name": "Cricket"
},
{
"id": "2",
"name": "Football"
}
];
categoryToSelect = this.prtl.category;
}