我想实施一个注册过程。有4种形式,一种带有基本信息,另一种是关于位置首选项,依此类推。我创建了一个使用数据服务与后端进行通信的组件。该主要组件有4个子组件,其中包含相应的表格。第一种形式创建一个对象,而第二种形式则需要该对象。在第三种形式中需要第二种形式的输出,最后一种形式也是如此。我也想设置路由,但这不是必需的。
<app-basicinfo-form
(output)="onDataChange($event)"></app-basicinfo-form>
这就是我从第一种形式到主要组件的输出的方式。我想将此输出从主要组件传递到第二种形式。
<app-locationpref-form
[object]="..."></<app-locationpref-form>>
我该写些什么?我该如何实现表单之间的呈现?
这来自我为组件创建的模块。
const routes: Routes = [
{
path: 'enrollment',
children: [
{ path: '', component: EnrollmentComponent },
{ path: 'basicinfo', component: BasicinfoFormComponent },
{ path: 'location', component: LocationFormComponent },
{ path: 'role', component: RoleFormComponent },
{ path: 'tools', component: ToolsFormComponent }
]
}
];
我需要这里的东西吗?如何在表格之间传递对象?
答案 0 :(得分:0)
如果您愿意使用Angular Material,我认为步进控制将满足您的需求。同样,在每个选项卡中具有窗体的选项卡控件以及在窗体之间导航的按钮也将有所帮助。
请参阅以下链接:
https://material.angular.io/components/stepper/overview
https://material.angular.io/components/tabs/overview
我两个人都亲自使用过。
答案 1 :(得分:0)