Browse Source

Fixed author part angular UI

pull/5260/head
Halil İbrahim Kalkan 6 years ago
parent
commit
423744c428
  1. 2
      docs/en/Tutorials/Part-3.md
  2. 19
      docs/en/Tutorials/Part-9.md
  3. BIN
      docs/en/Tutorials/images/bookstore-angular-service-proxy-author-2.png

2
docs/en/Tutorials/Part-3.md

@ -1053,7 +1053,7 @@ export class BookComponent implements OnInit {
}
const request = this.selectedBook.id
? this.bookService.update(this.form.value, this.selectedBook.id)
? this.bookService.update(this.selectedBook.id, this.form.value)
: this.bookService.create(this.form.value);
request.subscribe(() => {

19
docs/en/Tutorials/Part-9.md

@ -621,7 +621,7 @@ abp generate-proxy
This command generates the service proxy for the author service and the related model (DTO) classes:
![bookstore-angular-service-proxy-author](images/bookstore-angular-service-proxy-author.png)
![bookstore-angular-service-proxy-author](images/bookstore-angular-service-proxy-author-2.png)
### AuthorComponent
@ -630,8 +630,7 @@ Open the `/src/app/author/author.component.ts` file and replace the content as b
```js
import { Component, OnInit } from '@angular/core';
import { ListService, PagedResultDto } from '@abp/ng.core';
import { AuthorDto } from './models';
import { AuthorService } from './services';
import { AuthorService, AuthorDto } from '@proxy/authors';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { NgbDateNativeAdapter, NgbDateAdapter } from '@ng-bootstrap/ng-bootstrap';
import { ConfirmationService, Confirmation } from '@abp/ng.theme.shared';
@ -649,7 +648,7 @@ export class AuthorComponent implements OnInit {
form: FormGroup;
selectedAuthor = new AuthorDto();
selectedAuthor = {} as AuthorDto;
constructor(
public readonly list: ListService,
@ -659,7 +658,7 @@ export class AuthorComponent implements OnInit {
) {}
ngOnInit(): void {
const authorStreamCreator = (query) => this.authorService.getListByInput(query);
const authorStreamCreator = (query) => this.authorService.getList(query);
this.list.hookToQuery(authorStreamCreator).subscribe((response) => {
this.author = response;
@ -667,13 +666,13 @@ export class AuthorComponent implements OnInit {
}
createAuthor() {
this.selectedAuthor = new AuthorDto();
this.selectedAuthor = {} as AuthorDto;
this.buildForm();
this.isModalOpen = true;
}
editAuthor(id: string) {
this.authorService.getById(id).subscribe((author) => {
this.authorService.get(id).subscribe((author) => {
this.selectedAuthor = author;
this.buildForm();
this.isModalOpen = true;
@ -697,14 +696,14 @@ export class AuthorComponent implements OnInit {
if (this.selectedAuthor.id) {
this.authorService
.updateByIdAndInput(this.form.value, this.selectedAuthor.id)
.update(this.selectedAuthor.id, this.form.value)
.subscribe(() => {
this.isModalOpen = false;
this.form.reset();
this.list.get();
});
} else {
this.authorService.createByInput(this.form.value).subscribe(() => {
this.authorService.create(this.form.value).subscribe(() => {
this.isModalOpen = false;
this.form.reset();
this.list.get();
@ -716,7 +715,7 @@ export class AuthorComponent implements OnInit {
this.confirmation.warn('::AreYouSureToDelete', '::AreYouSure')
.subscribe((status) => {
if (status === Confirmation.Status.confirm) {
this.authorService.deleteById(id).subscribe(() => this.list.get());
this.authorService.delete(id).subscribe(() => this.list.get());
}
});
}

BIN
docs/en/Tutorials/images/bookstore-angular-service-proxy-author-2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Loading…
Cancel
Save