角度-路线ID未填充

问题描述

当某人提交表单时,会将其转移到新页面,URL为-4200 / id 当前,ID为“”。并且没有人口稠密。我最近添加了“ PrimeNG”,但我怀疑这与它无关。 我该如何解决?非常感谢任何回答的人,我整日都在解决这个问题。

{ // Routing Module
path: ':id',loadChildren: () =>
  import('./features/project-details/project-details.module').then(
    (m) => m.ProjectDetailsModule
  ),

},

// The form button that submits the data.
<button
  type="submit"
  class="btn btn-primary"
  [disabled]="form.invalid"
  [routerLink]="['',newProject.id]"
  routerLinkActive="router-link-active"
>
  Submit
</button>

// The Submit() Method.
this.newProject.projectName = this.form.get('name').value;
this.newProject.projectDescription = this.form.get('description').value;
this.newProject.interests = this.categoriesFormArraySelectedIds;
const uid = this.afsc.createId();
this.newProject.id = uid;
this.firestoreService.createProject(this.newProject,uid);


// Details Page (The page that gets the data from the ID that you send.)
ngOnInit() {
this.route.paramMap.subscribe((data) => {
  this.routeName = data.get('id');
});

this.firestore
  .collection('Projects',(query) =>
    query.where('id','==',this.routeName)
  )
  .get()
  .subscribe((data) => {
    data.forEach((doc) => {
      // tslint:disable-next-line: no-shadowed-variable
      const data = doc.data();
      this.projectName = data.projectName;
      this.projectDescription = data.projectDescription;
      this.interests = data.interests;
      this.id = data.id;
      this.interests.join('+');
    });
  });

}

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)