如何在反应形式控件内使用html标签?

时间:2019-01-22 01:30:27

标签: angular angular-forms

我有这样的东西:

hc <- highchart() %>%
  hc_chart(type = "column") %>%
  hc_title(text = "Job Ratio") %>%
  hc_xAxis(categories = c("Job A", "Job B")) %>%
  hc_plotOptions(series = list(stacking = "normal")) %>%
  hc_yAxis(max = 100) %>%
  hc_add_series(name = "Completed", 
                data = list(list(y = 40, drilldown = "job-a"), 
                            list(y = 35, drilldown = "job-a"))) %>%
  hc_add_series(name = "No progress", data = c(60, 65)) %>%
  hc_drilldown(
    allowPointDrilldown = TRUE,
    series = list(
      list(
        id = "job-a",
        categories = c("Job A1", "Job A2"),
        series = list(
          list(
            name = "Completed",
            data = list(
              list(y = 55), 
              list(y = 45)
            )
          ),
          list(
            name = "No Progress",
            data = list(
              list(y = 45),
              list(y = 55)
            )
          )
        )
      )
    )
  )
hc

该元素是textarea。 如何在textarea内设置标签? 我尝试使用innerHTML失败,但是仍然看到html标签。

谢谢!

1 个答案:

答案 0 :(得分:0)

对于我来说,我找到了一个简单的解决方案

const htmlStr = 'text1\ntext2\ntext3';
this.emailForm=new FormGroup({
      outcomeSubject: new FormControl(htmlStr, Validators.required),
      outcomeNotes: new FormControl(htmlStr, Validators.required)
    })