The problem with the Angular form caused by the NULL field in the database-I had to circle the earth to get into the fork in front of me.

  • NULL data in the database
  • Angular

    DB

  • Angular

    console.log():

    NULL

  • Angular

    :this.expandForm.setValue({...val[0]});:

    valoordercode



  • after processing by the above method, you can assign the value that exists on the DB side to
    when all the attributes are present. If there is a value on the DB side, fill it, and then the NULL value on the DB side is also NULL
    . Then you can happily assign the value: {... newData} later.
    I feel so tired. Is there any other way to achieve it? Or did I go the wrong way in the first place?
    Welcome to contact QQ:409223171, please indicate: null


Database fields are better off without null, and each field is given a default value. For example, the field definition of mysql table

  `currency_desc` varchar(100) NOT NULL DEFAULT '' COMMENT 'xxxx',
  `days` int(11) NOT NULL DEFAULT '0' COMMENT 'xxxxxx',
Menu