Alejandro Gervasio b10782f89e Building a web application with Spring Boot and Angular (#6496)
* Initial Commit

* Delete angularclient folder

* Add spring-boot-angular module to root pom.xml

* Update pom.xml

* Update root pom.xml

* Update root pom.xml
2019-03-11 09:49:16 -05:00

27 lines
677 B
TypeScript

import { Component } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { UserService } from '../service/user.service';
import { User } from '../model/user';
@Component({
selector: 'app-user-form',
templateUrl: './user-form.component.html',
styleUrls: ['./user-form.component.css']
})
export class UserFormComponent {
user: User;
constructor(private route: ActivatedRoute, private router: Router, private userService: UserService) {
this.user = new User();
}
onSubmit() {
this.userService.save(this.user).subscribe(result => this.gotoUserList());
}
gotoUserList() {
this.router.navigate(['/users']);
}
}