组件中的 Angular2 router.redirect 正在加载组件。但视图中的 http 数据填充延迟超过 10 秒
Angular2 router.redirect in component is loading the component. But http data population in view is delaying for more than 10 seconds
在我的 Angular 应用程序中,我有一个类别控制器。
其中(它必须检查是否选择了客户或 not.If 而不是必须重定向到客户查看页面。
工作正常。(但是当重定向到客户页面时 - 客户列表正在组件构造函数中填充 - 而不是在视图页面中加载)
几秒后(差不多 10-15 秒)。
正在查看页面中加载。
But if i open customer page by clicking the menu.(data loading is Fine).Why is this issue occurring
I have used some jquery inside typsecript for click functions and so.
I will post my code along with this please verify and help me.
Thank you.
constructor(private sidepageadd:SidePageAddService, private router:Router ,private zone:NgZone)
{
this.category_id=this.sidepageadd.getcategory_id();
this.categoryName=sidepageadd.getcategoryName();
this.customer_id=this.sidepageadd.getcustomer_id();
this.employee_id=this.sidepageadd.getemployee_id();
if(this.customer_id==undefined){
toastr["error"]("Kindly Choose a customer to Begin with!");
this.router.navigate( ['/home', {outlets: {'menu': 'home/viewCustomer'}}]);
}
else if(this.category_id==undefined){
alert("Choose a category");
}
var catName=this.categoryName;
if($('#catName').text()!=catName){
$('#catName').text(catName);
}
}
在查看秒数后,视图会像这样填充
我之前遇到过类似的问题,
我使用 jquery 进行 DOM 操作
学习使用 viewchild、Renderer、Elementref 等,并使用 queryselector 在 typescript 代码中操作 dom。
完成此 link:
https://blog.angularindepth.com/exploring-angular-dom-abstractions-80b3ebcfc02
(我从这里学到的)
我想这会对你有所帮助。
在我的 Angular 应用程序中,我有一个类别控制器。 其中(它必须检查是否选择了客户或 not.If 而不是必须重定向到客户查看页面。 工作正常。(但是当重定向到客户页面时 - 客户列表正在组件构造函数中填充 - 而不是在视图页面中加载) 几秒后(差不多 10-15 秒)。 正在查看页面中加载。
But if i open customer page by clicking the menu.(data loading is Fine).Why is this issue occurring
I have used some jquery inside typsecript for click functions and so.
I will post my code along with this please verify and help me.
Thank you.
constructor(private sidepageadd:SidePageAddService, private router:Router ,private zone:NgZone)
{
this.category_id=this.sidepageadd.getcategory_id();
this.categoryName=sidepageadd.getcategoryName();
this.customer_id=this.sidepageadd.getcustomer_id();
this.employee_id=this.sidepageadd.getemployee_id();
if(this.customer_id==undefined){
toastr["error"]("Kindly Choose a customer to Begin with!");
this.router.navigate( ['/home', {outlets: {'menu': 'home/viewCustomer'}}]);
}
else if(this.category_id==undefined){
alert("Choose a category");
}
var catName=this.categoryName;
if($('#catName').text()!=catName){
$('#catName').text(catName);
}
}
在查看秒数后,视图会像这样填充
我之前遇到过类似的问题, 我使用 jquery 进行 DOM 操作 学习使用 viewchild、Renderer、Elementref 等,并使用 queryselector 在 typescript 代码中操作 dom。
完成此 link: https://blog.angularindepth.com/exploring-angular-dom-abstractions-80b3ebcfc02 (我从这里学到的) 我想这会对你有所帮助。