<div class="container">
<!-- (submit) two way databind da view para model -->
<form class="row" (submit)="cadastra($event)">
<div class="col-md-6">
<div class="form-group">
<label>Título</label>
<input class="form-control" autocomplete="off">
</div>
<div class="form-group">
<label>URL</label>
<input class="form-control" autocomplete="off">
</div>
<div class="form-group">
<label>Descrição</label>
<textarea class="form-control" autocomplete="off">
</textarea>
</div>
<button type="submit" class="btn btn-primary">
Salvar
</button>
<a [routerLink]="['']" class="btn btn-primary">Voltar</a>
<hr>
</div>
</form>
</div>
form
import { Component } from "@angular/core";
import { FotoComponent } from "../foto/foto.component";
@Component({
moduleId: module.id,
selector: 'cadastro',
templateUrl: './cadastro.component.html'
})
export class CadastroComponent{
foto: FotoComponent = new FotoComponent();
cadastra(event){
event.preventDefault();
console.log('Chegou', event);
console.log(this.foto);
}
}
component
meu repositorio no github https://github.com/KynnMaia/curso-angular