,self并不受angular管理,导致刷新的变量是self中的isBackColor.
3.2http参数传递
按照下面代码传参数应该是没有问题的,但是我遇到了url被编码问题,例如输入`1111@qq.com...号参数风格的.两种参数都保存在ActivatedRoute对象中,因此下面代码中的route为此对象
— restful风格
配置:{path:'article/:id',component:ArticleComponent...中的一系列方法,或者this.route.snapshot.params['id']
— 问号参数风格
配置:{path:'article',component:ArticleComponent}
链接...id=1
路由:routerLink="article" [queryParams]="{id: article.id}"
js获取:this.route.queryParams中的一系列方法,或者this.route.snapshot.queryParams...['id'],另外可以使用订阅模式queryParamMap.subscribe(),路由参数更新时自动通知
3.5组件通信
父->子:子组件使用input装饰器,接受父组件的属性,并且可使用ngOnChanges