variablen deklaration

This commit is contained in:
marcusferl@weifer.de 2022-08-30 12:39:53 +02:00
parent ccf0890453
commit 773797031d
5 changed files with 32 additions and 9 deletions

View File

@ -10,6 +10,7 @@ import { MatInputModule } from '@angular/material/input';
import { MatFormFieldModule } from '@angular/material/form-field'; import { MatFormFieldModule } from '@angular/material/form-field';
import { MatSelectModule } from '@angular/material/select'; import { MatSelectModule } from '@angular/material/select';
import { OutputComponent } from './output/output.component'; import { OutputComponent } from './output/output.component';
import { FormsModule } from '@angular/forms';
@NgModule({ @NgModule({
@ -25,7 +26,8 @@ import { OutputComponent } from './output/output.component';
BrowserAnimationsModule, BrowserAnimationsModule,
MatInputModule, MatInputModule,
MatFormFieldModule, MatFormFieldModule,
MatSelectModule MatSelectModule,
FormsModule
], ],
providers: [], providers: [],
bootstrap: [AppComponent] bootstrap: [AppComponent]

View File

@ -1,16 +1,16 @@
<div class="input"> <div class="input">
<mat-form-field class="input_field" appearance="fill"> <mat-form-field class="input_field" appearance="fill">
<mat-label>IPv4</mat-label> <mat-label>IPv4</mat-label>
<input matInput> <input matInput [(ngModel)]="ipv4_eingabe">
</mat-form-field> </mat-form-field>
<mat-form-field class="select" appearance="fill"> <mat-form-field class="select" appearance="fill">
<mat-label>Prefix</mat-label> <mat-label>Prefix</mat-label>
<mat-select> <mat-select [(ngModel)]="prefix_selection">
<mat-option *ngFor="let number of counter" value="{{number}}"> <mat-option *ngFor="let number of counter" value="{{number}}">
{{number}} {{number}}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<button mat-raised-button>Calculate</button> <button mat-raised-button (click)="onClick();">Calculate</button>
</div> </div>

View File

@ -7,13 +7,19 @@ import { Component, OnInit } from '@angular/core';
}) })
export class InputComponent implements OnInit { export class InputComponent implements OnInit {
counter: Array<number> = []; counter: Array<number> = [];
ipv4_eingabe: string = "";
prefix_selection: number = 0;
constructor() { constructor() {
for (let i = 0; i <= 32; i++) { for (let i = 0; i <= 32; i++) {
this.counter.push(i); this.counter.push(i);
} }
} }
onClick() {
alert(this.prefix_selection + " " + this.ipv4_eingabe)
}
ngOnInit(): void { ngOnInit(): void {
} }

View File

@ -1,3 +1,5 @@
<div class="card"> <div class="card" *ngFor="let name of out">
<label>Subnetmask:</label> <label class="label">{{name}}</label>
<p><label class="outlabel">IP:</label><label>{{ipv4_dec}}</label></p>
<p><label class="outlabel">Binary:</label><label>{{ipv4_bin}}</label></p>
</div> </div>

View File

@ -1,9 +1,22 @@
.card { .card {
min-height: 20px; min-height: 40px;
background-color: white; background-color: white;
width: 600px; width: 700px;
border: 1px solid rgba(0, 0, 0, 0.30); border: 1px solid rgba(0, 0, 0, 0.30);
border-radius: 10px; border-radius: 10px;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
padding-left: 10px;
padding-top: 5px;
margin-bottom: 10px;
margin-left: 5px;
}
.label {
font-size: 18px;
}
.outlabel {
margin-right: 30px;
} }