A
Anonymous

Country Capital Game - Copy this Angular, Css Component to your project

Implement a game to match countries with their capitals in Angular. Requirements Implement an Angular compnent that renders a simple game. In the game, the player needs to match a country to its capital by clicking on appropriate buttons. 1. Your component should receive a data o property in the following format (an object with the correct answer, where the keys are the names of the countries and the value of each key is the capital of the country). 2. A button should be displayed for each country and each capital. 3. The buttons should be displayed in a random order. 4. Clicking a button should set its background color to blue (#0000ff0 ). Clicking another button should: * remove both buttons if the correct country and capital pair has been selected; * set the background color of both buttons to red (#ff0000D ) if a wrong pair has been selected. Assuming the previously selected pair was wrong, clicking another button should restore the default background color of the wrong pair and set the background color of the clicked button to blue. Import { Component, Input } from '@angular/core'; import { bootstrapApplication } from '@angular/platform browser'; type Data = { [key: string]: string; }; @Component({ selector: 'app root', template: ` <div></div> `, }) export class App { @Input() data: Data = {}; } bootstrapApplication(App); dont implement reset button and highscores

Prompt

About

Country Capital Game - Match countries with capitals using buttons. Features random order, color changes for correct/incorrect pairs. Bu. Start coding now!

Share

Last updated 1 month ago