Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files
Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build
π» Code Examples
server component with functions used to generate html template data.
import{Component}from'@angular/core';
@Component({selector: 'app-server',templateUrl: './server.component.html',styles: [` .online { color: white; } `]})exportclassServerComponent{serverId=10;serverStatus='offline';// use a random number generator function to get a random status of on or offlineconstructor(){this.serverStatus=Math.random()>0.5 ? 'online' : 'offline';}// function to return the random server statusgetServerStatus(){returnthis.serverStatus;}// function to show online status with a green background and offline with red.getColor(){returnthis.serverStatus==='online' ? 'green' : 'red';}}
π Features
Server names can be added via a form-control input field.
The background color of each server in the list changes depending on the online status of the server.