我从后端获取数据并以视图行的形式绑定到视图中,然后我在表上调用datatable函数,但在视图显示行之前调用该函数。
$params['auth_type'] = 'rerequest';
答案 0 :(得分:0)
找到解决方案
Section VPermutation_properties.
Require Import Sorting.Permutation.
Variable A:Type.
Lemma ListVecPermutation {n} {l1 l2} {v1 v2}:
l1 = list_of_vec v1 ->
l2 = list_of_vec v2 ->
Permutation l1 l2 ->
VPermutation A n v1 v2.
Proof.
intros H1 H2 P; revert n v1 v2 H1 H2.
dependent induction P; intros n v1 v2 H1 H2.
- dependent destruction v1; inversion H1; subst.
dependent destruction v2; inversion H2; subst.
apply vperm_nil.
- dependent destruction v1; inversion H1; subst.
dependent destruction v2; inversion H2; subst.
apply vperm_skip.
now apply IHP.
- do 2 (dependent destruction v1; inversion H1; subst).
do 2 (dependent destruction v2; inversion H2; subst).
apply list_of_vec_eq in H5; subst.
apply vperm_swap.
- assert (n = length l').
{ pose proof (Permutation_length P1) as len.
subst.
now rewrite list_of_vec_length in len.
}
subst.
apply vperm_trans with (l' := vec_of_list l').
-- apply IHP1; auto.
now rewrite list_of_vec_vec_of_list.
-- apply IHP2; auto.
now rewrite list_of_vec_vec_of_list.
Qed.
End VPermutation_properties.
这是正确的吗?
答案 1 :(得分:0)
生命周期钩子JMeq_eq
将在组件视图及其子视图初始化后调用。
试试这个
import { Component, OnInit } from '@angular/core';
import {HttpClient} from '@angular/common/http';
declare var $ :any;
@Component({
selector: 'app-vendors',
templateUrl: './vendors.component.html',
styleUrls: ['./vendors.component.css']
})
export class VendorsComponent implements OnInit {
vendors: any;
dataRetrieved:any;
constructor(private http: HttpClient) {
this.dataRetrieved=false;
}
ngOnInit() {
this.http.get('backendLINK').subscribe(data => {
// Read the result field from the JSON response.
this.vendors = data['vendors'];
this.dataRetrieved=true;
// $("#vendors-datatable").DataTable({});
console.log(this.vendors);
});
}
ngAfterViewChecked() {
if (this.dataRetrieved) {
$("#vendors-datatable").DataTable({});
}
}
}