Django + Angular 6 example | Django Rest Framework + MySQL CRUD example – Part 3: Angular Client

https://ozenero.com/django-angular-6-example-django-rest-framework-angular-crud-mysql-example-part-3-angular-client

Django + Angular 6 example | Django Rest Framework + MySQL CRUD example – Part 3: Angular Client

This tutorial is part 3 of Django-Ang…


This content originally appeared on DEV Community and was authored by loizenai

https://ozenero.com/django-angular-6-example-django-rest-framework-angular-crud-mysql-example-part-3-angular-client

Django + Angular 6 example | Django Rest Framework + MySQL CRUD example – Part 3: Angular Client

This tutorial is part 3 of Django-Angular-MySQL series. Today, we will create Angular Client to make HTTP request & receive response from Django Server.

>> Part 1: Overview
>> Part 2: Django Server

Video

Angular Client Overview

Goal

The image below shows overview about Angular Components that we will create:

django-angular-6-django-rest-api-mysql-angular-client-architecture

Project Structure

django-angular-6-django-rest-api-mysql-angular-project-structure

We have:
- 4 components: customers-list, customer-details, create-customer, search-customer.
- 3 modules: FormsModule, HttpClientModule, AppRoutingModule.
- customer.ts: class Customer (id, firstName, lastName)
- customer.service.ts: Service for Http Client methods
- app-routing.module.ts: Routing configuration

Setup Angular Project

Create Angular Project

Run command: ng new AngularDjango.

Create Service & Components

On Project folder, run commands below:
- ng g s customer
- ng g c create-customer
- ng g c customer-details
- ng g c customers-list
- ng g c search-customers
On each Component selector, delete app- prefix, then change tslint.json rules - "component-selector" to false.

Implement Angular Client App

Data Model

Create new file named customer.ts:

export class Customer {
    id: number;
    name: string;
    age: number;
    active: boolean;
}
Data Service

More at:

Django + Angular 6 example | Django Rest Framework + MySQL CRUD example – Part 3: Angular Client

https://ozenero.com/django-angular-6-example-django-rest-framework-angular-crud-mysql-example-part-3-angular-client


This content originally appeared on DEV Community and was authored by loizenai


Print Share Comment Cite Upload Translate Updates
APA

loizenai | Sciencx (2021-04-19T17:25:28+00:00) Django + Angular 6 example | Django Rest Framework + MySQL CRUD example – Part 3: Angular Client. Retrieved from https://www.scien.cx/2021/04/19/django-angular-6-example-django-rest-framework-mysql-crud-example-part-3-angular-client/

MLA
" » Django + Angular 6 example | Django Rest Framework + MySQL CRUD example – Part 3: Angular Client." loizenai | Sciencx - Monday April 19, 2021, https://www.scien.cx/2021/04/19/django-angular-6-example-django-rest-framework-mysql-crud-example-part-3-angular-client/
HARVARD
loizenai | Sciencx Monday April 19, 2021 » Django + Angular 6 example | Django Rest Framework + MySQL CRUD example – Part 3: Angular Client., viewed ,<https://www.scien.cx/2021/04/19/django-angular-6-example-django-rest-framework-mysql-crud-example-part-3-angular-client/>
VANCOUVER
loizenai | Sciencx - » Django + Angular 6 example | Django Rest Framework + MySQL CRUD example – Part 3: Angular Client. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/04/19/django-angular-6-example-django-rest-framework-mysql-crud-example-part-3-angular-client/
CHICAGO
" » Django + Angular 6 example | Django Rest Framework + MySQL CRUD example – Part 3: Angular Client." loizenai | Sciencx - Accessed . https://www.scien.cx/2021/04/19/django-angular-6-example-django-rest-framework-mysql-crud-example-part-3-angular-client/
IEEE
" » Django + Angular 6 example | Django Rest Framework + MySQL CRUD example – Part 3: Angular Client." loizenai | Sciencx [Online]. Available: https://www.scien.cx/2021/04/19/django-angular-6-example-django-rest-framework-mysql-crud-example-part-3-angular-client/. [Accessed: ]
rf:citation
» Django + Angular 6 example | Django Rest Framework + MySQL CRUD example – Part 3: Angular Client | loizenai | Sciencx | https://www.scien.cx/2021/04/19/django-angular-6-example-django-rest-framework-mysql-crud-example-part-3-angular-client/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.