角反应形式子组件 [英] Angular reactive form child component

查看:51
本文介绍了角反应形式子组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用DE/EN数据创建可重用的输入组组件.

I would like create reusable input group component with DE/EN data.

我正在寻找,一旦EN和DE的所有必填字段都填写完毕,然后应该启用提交"按钮.并且还应该以JSON格式获取所有数据.

I'm looking for, once all the mandatory fields are filled for EN and DE then submit button should get enabled. And also should get all the data in JSON format.

这里是示例 https://stackblitz.com/编辑/angular-avjyct?file=app/app.component.ts

我一直在尝试,但是卡住了.请高手指点吗?

I have been trying but stuck. Expert advise please?

推荐答案

看起来您想将字符串值传递给子组件,但是却传递了 undefined :

Looks like you wanted to pass string value to your child component but passed undefined instead:

[en]="label1_en"
      ^^^^^^^^^
there is no such property in your component.

您可以像这样传递字符串:

You can pass string like:

[en]="'label1_en'"

en="label1_en"

分叉的Stackblitz

Forked Stackblitz

这篇关于角反应形式子组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆