25组件之间的通信(练习)

时间:2020-01-22 09:43:22   收藏:0   阅读:81

练习:试下一个SPA   demo21/

header.component.ts 页头组件,实现子与父通信,定义一个方法,用来返回 true/false

cart.component.ts 购物车组件,渲染一个列表,就在ngOnInit 处理方法中通过ViewChild 调用 header组件中的方法,如果返回true渲染列表也,否则就不显示列表,放一个按钮,点击跳转到 订单确认

orderComfirm.component.ts  订单确认组件

  step1,button--》确认商品

  step2,button--》支付

  支持嵌套组件,step1.component.ts,step2.component.ts

原文:https://www.cnblogs.com/shanlu0000/p/12227643.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!