0
export class CreateOrderComponent implements OnInit 
{
    myorder = new Order(0,0,0);
    onSubmit(value){  
        console.log('you submitted value:',value); 
        this.pickup(); 
    }
    constructor(private router: Router) { }
    pickup() {
        this.router.navigate(['/pickupLocation']); 
    }
    shipper() {
        this.router.navigate(['/shipper']); 
    }
    ngOnInit() { }
}

我正在尝试将对象从我的表单传递到类似页面的侧边栏。我怎么能做到这一点?

4

1 回答 1

0

您可以使用 @Input 将数据共享给另一个子组件。看看下面的链接。

https://www.themarketingtechnologist.co/building-nested-components-in-angular-2/

https://www.infragistics.com/community/blogs/dhananjay_kumar/archive/2016/12/13/communication-between-components-using-input-in-angular-2.aspx

于 2017-07-12T20:56:50.360 回答