Skip to content

Commit

Permalink
nice form
Browse files Browse the repository at this point in the history
  • Loading branch information
Plasmoxy committed Aug 9, 2020
1 parent 519964b commit 7d1894b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
@@ -1,4 +1,4 @@
<form>
<form #itemForm="ngForm" (ngSubmit)="onSubmit(itemForm)">
<div class="field is-horizontal">
<div class="field-body">

Expand All @@ -15,7 +15,7 @@
</div>

<div class="field is-narrow">
<button class="button is-primary">Add</button>
<button type="submit" class="button is-primary">Add</button>
</div>
</div>
</div>
Expand Down
@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { NgForm } from '@angular/forms'

@Component({
selector: 'app-add-item-form',
Expand All @@ -10,6 +11,11 @@ export class AddItemFormComponent implements OnInit {
constructor() { }

ngOnInit(): void {

}

onSubmit(form: NgForm) {
console.log(form)
}

}
4 changes: 3 additions & 1 deletion Frontend/Angular/budget-app/src/app/app.module.ts
@@ -1,5 +1,6 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
Expand All @@ -18,7 +19,8 @@ import { BudgetItemCardComponent } from './budget-item-list/budget-item-card/bud
],
imports: [
BrowserModule,
AppRoutingModule
AppRoutingModule,
FormsModule,
],
providers: [],
bootstrap: [AppComponent]
Expand Down

0 comments on commit 7d1894b

Please sign in to comment.