Answers for "preselect a value in angular dropdown"

0

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;
}
Posted by: Guest on July-10-2021

Code answers related to "preselect a value in angular dropdown"

Browse Popular Code Answers by Language