Angular 2:ActivatedRouter不会占用3个参数

时间:2017-10-30 18:29:03

标签: angular

ActivatedRouter不会占用3个参数。它给出了如下错误。请帮忙。

错误:

import numpy as np
import threading
import time
import matplotlib.pyplot as plt

class Worker(object):
    def __init__(self):
        super(Worker, self).__init__()
        self.x = np.linspace(0,1,1000)
        self.y = np.zeros_like(self.x)

    def simulate(self):
        for i in range(15):
            self.y += np.random.randn(1000)
            self.y -= self.y.min()
            time.sleep(1)  # simulate some much longer simulation time
        print("Simulation finished")

w = Worker()
thread = threading.Thread(target=w.simulate)
thread.start()

fig, ax = plt.subplots()
line, = ax.plot(w.x,w.y)

plt.show(block=False)

while thread.is_alive():
    line.set_data(w.x, w.y)
    ax.set_ylim(w.y.min(), w.y.max())
    plt.pause(0.05)

plt.show()

代码:

[ts] Expected 1-2 arguments, but got 3.

1 个答案:

答案 0 :(得分:1)

您只能将2个参数传递给this.router.navigate()其他选项可以像这样传递

let navigationExtras: NavigationExtras = {
  queryParams: { page: id },
  fragment: 'top'
};

this.router.navigate(['child',id], navigationExtras);

您可以查看此doc了解更多信息。