我可以在构造函数之外获取this.operator.lable的值。我在构造函数之外需要它
operator: {} = {};
constructor( private route: ActivatedRoute, private router: Router ) {
this.route.queryParams.subscribe(params => {
if (this.router.getCurrentNavigation().extras.state) {
this.data = this.router.getCurrentNavigation().extras.state;
this.operator = this.data.operator;
}
});
}
this.validation_messages.number.push({ type: 'required', message: this.operator.lable + ' is required.' });
this.validation_messages.number.push({ type: 'pattern', message: this.operator.message });