Angularで作るER DIAGRAM TOOL – 第四回 データ用クラスの準備と、データサービスの作成からDIまで。

Data handled by this application,
Basically, crud-d-scaffold.json of dog-ears / crud-d-scaffold and
Make it the same shape.


– param1
– models[
– param1
– param1
– param1
– param1
– param1

The basic data structure is as shown above.

(1) Preparation of Class

Create classes of Data, Model, Schema




· Each class is initialized in Constructor ().
· Data has _next_model_id and model has _next_schema_id and each has a function that returns a new ID.
· Schema has an item called parent_id so that you can know which model is parent by itself.

(2) Creation of dataService

A service that manages data.
Add and delete data always goes through here.
Each component will DI this service and invoke the method of the service.


· Have a member variable data and initialize it with constructor ().

(3) DI of dataService


・import DataService


· Import of Data, DataService
· Addition of member variable data
· DI of DataService with Constructor and initial data storage


We placed an ER diagram drawing area in the left column and an information area displaying the data contents in the right column.
The information area feels unnecessary, but it is useful because it is convenient for debugging.



By the way, in the method of each component,
First we put console.log.
It is recommended because the data flow is easy to follow.

Next time back to navbar again,
I will set Modal to update Data.