I have this UI router state with a component attached to it:
export const exchangeState = {
name: 'exchange',
url: '/exchange',
component: ExchangeMainComponent,
resolve: [
{
token: 'fromResolve',
resolveFn: () => {
return 'string from resolve';
}
}
]
};
In component's constructor I trying to access fromResolve but it returns undefined. This is the component:
@Component({
selector: 'app-exchange-main',
templateUrl: './exchange-main.component.html',
styleUrls: ['./exchange-main.component.css']
})
export class ExchangeMainComponent implements OnInit {
@Input('fromResolve') fromResolve: string;
constructor() {
console.log(this.fromResolve); // <- undefined
}
ngOnInit() {
}
}
fromResolve showing up correctly in the view.
How can I have it's value in the constructor?