preselect a value in angular dropdown
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;
}