简体   繁体   English

如何在特定输入标签下方的子组件angular4中传递并显示服务中的验证错误

[英]How to pass and show validation error from service in child component angular4 below particular input tag

我正在使用Angular 4反应形式,并创建了一条指令(分别在父输入和子输入中调用)以在有人输入并删除内容的情况下在每个输入字段下方显示错误,该错误显示在该字段下方(新的div元素)已创建),但现在我想在提交表单时在父级和子级组件中显示错误(提交按钮位于父类中)

Create a message service and store all the validation error message to it. 创建一个消息服务,并将所有验证错误消息存储到其中。 Upon submit display the content if any. 提交后显示内容(如果有)。

Also you can keep them in separate arrays or whatsoever you like and display accordingly. 您也可以将它们放在单独的阵列中,也可以随意放置并进行相应显示。

HTH HTH

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Angular4 @Input()将值从父组件传递到子组件 - Angular4 @Input() to pass value from parent component to child component 如何在Angular4中将数据从子组件传递到父组件 - How to pass data from child component to parent component in Angular4 将数据从子组件传递到父组件Angular4 - pass data from child component to parent component Angular4 无法在angular4中将数据从父组件传递到子组件 - Not able to pass data from parent to child component in angular4 如何将javascript值从index.html传递到Angular4的子组件 - How to pass javascript values from index.html to child component in Angular4 如何将服务返回的数据作为子组件的输入传递? 角度2 - How to pass service returned data as an input of child component? Angular 2 如何将id从angular4中的另一个兄弟传递给兄弟组件? - How to pass the id to the sibling component from another sibling in angular4? 如何从angular4(ionic3)的服务提供者组件传递响应给父组件,我得到了未定义的值? - how to pass a response to parent component from service provider component of angular4 (ionic3), i got undefined value? 在angular4中使用锚标记“ href”从子组件查看父组件中内容的内容? - View of content in parent component from child component using anchor tag 'href' in angular4? 如何将数据 Input() 从组件传递到服务 class Angular - how to pass data Input() from component to service class Angular
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM