'Routing in Aurelia2

After I click Save Device, I want it to return to my default route where is list with all my devices, it adds a new Device but it show error on : "this.router.load("administration/agent-manager/agent-details/agent-details")".

an error:

Uncaught (in promise) TypeError: this.router.load is not a function at NewAgentDevice.saveDevice

Here is my code in typescript:

async saveDevice() {
    let result = await this.AgentManagerApiClient.addOpcDevice(this.agentId, this.device);
    if (result.isSuccess) {
        toastr.success("Successfully created");
        // return './administration0/agent-details';
        this.router.load("administration/agent-manager/agent-details/agent-details")
        // this.router.load("/administration/agent-details(id=" + this.agentId + ")");
    }
    else {
        toastr.error(result.error)
    }
}

and I have imported route from Aurelia:

constructor(private AgentManagerApiClient: AgentManagerApiClient, @IRouter private router: IRouter, private store: Store<AppState>) {
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source