从一个组件检索数据到另一个组件

时间:2019-09-04 13:49:56

标签: javascript angular angular7 angular-routing

我们正在尝试使用NavigationExtras将数据从一个组件传递到另一个组件(从一个页面传递到另一个页面),如下所示

x  <- c(x, "redd"); y  <- c(y, "redd")

x[unique(unlist(sapply(paste0("^",y), grep, x)))]
#[1] "red"   "red"   "redd"  "white" "white" "blue"  "blue"  "green"

我正在尝试将x[unique(unlist(sapply(paste0("^",y), grep, x)), fromLast = TRUE)] [1] "red" "red" "white" "white" "blue" "blue" "green" "redd" x <- c(x, "yellow") x[unique(c(unlist(sapply(paste0("^",y), grep, x)), seq_along(x)))] [1] "red" "red" "redd" "white" "white" "blue" "blue" "green" [9] "yellow" 数组放入另一个组件

dt_data <- data.table('A' = c(1,3,2,1), 'B' = c(2,3,1,4))

dt_matrix <- data.table('A' = c(4,5), 'B' = c(3,2))


    A    B
1:  4    6

2: 12    9

3:  8    3

4:  4   12

5:  5    4

6: 15    6

7: 10    2

8:  5    8

3 个答案:

答案 0 :(得分:2)

收听queryParams并捕获NavigationExtras

android.optional.compilation

答案 1 :(得分:0)

constructor(private router: Router) {
           console.log(this.router.getCurrentNavigation().extras.state.Projectinfo); 
 // should log e.data
}

答案 2 :(得分:0)

您需要在构造函数内部调用getCurrentNavigation()方法,否则导航已结束。