Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 数据隐藏在视图4中_Angular_Firebase_Angularfire2 - Fatal编程技术网

Angular 数据隐藏在视图4中

Angular 数据隐藏在视图4中,angular,firebase,angularfire2,Angular,Firebase,Angularfire2,我正在开发firebase应用程序。获取的数据在DOM中,但li没有显示在load中,我在google中搜索过,但我无法找到它,这是我的代码: constructor(private authService: AuthService, private db: AngularFireDatabase) { } ngOnInit() { this.getOrders(); } getOrders() {

我正在开发firebase应用程序。获取的数据在DOM中,但li没有显示在load中,我在google中搜索过,但我无法找到它,这是我的代码:

    constructor(private authService: AuthService, private db: 
      AngularFireDatabase) {
      }

      ngOnInit() {
          this.getOrders();
     }

     getOrders() {
         this.db.list('/orders', { preserveSnapshot: true })
           .subscribe(snapshots => {
             snapshots.forEach(snapshot => {
               this.address = snapshot.val().address;
               this.phone = snapshot.val().phone;
               this.nombre = snapshot.val().nombre;
               this.items = snapshot.val().items;
               this.UID = snapshot.key;

          this.servicios.push({
            key: this.UID,
            address: this.address,
            phone: this.phone,
            nombre: this.nombre,
            items: this.items,
            UID: this.UID
          });
        });
      })
  }
现在在视图中,代码是一个循环

<ul *ngIf="servicios" class="orders">
    <li *ngFor="let servicio of servicios">
      <h4>Client: {{ servicio.nombre }}</h4>
      <p>Dirección: {{ servicio.address }}</p>
      <p>Teléfono: {{ servicio.phone }}</p>
    </li>
  </ul>


客户:{{servicio.nombre}
Dirección:{{servicio.address}

电话:{{servicio.phone}

数据在DOM中,但在屏幕中不可见:

如果我重新加载,它不会显示,但如果我更改选项卡并返回,数据会显示,抱歉,如果这是一个愚蠢的问题,但我无法理解,提前感谢社区


注意:引导选项卡的选项卡窗格淡入淡出状态处于活动状态,在活动状态下,它应该是选项卡窗格淡入淡出状态

您应该检查它的长度

<ul *ngIf="servicios.length > 0 " class="orders">


您应该检查它的长度

<ul *ngIf="servicios.length > 0 " class="orders">


嘿,谢谢你的重播,但是ul被包裹在一个*ngIf-already中,请也更新代码。如果你能创建一个plunker,那就太棒了。嘿,伙计,这太尴尬了,很抱歉浪费了你的时间,这是从引导程序中产生的,它错过了淡入课堂。。对不起that@AndresFelipe那么这是固定的吗?你说的淡入淡出是什么意思?@Vega我不明白你的意思。谢谢你的重播,但是ul被包裹在一个*ngIf-already中,请也更新代码。如果你能创建一个plunker,那就太棒了。嘿,伙计,这太尴尬了,很抱歉浪费了你的时间,这是从引导程序中产生的,它错过了淡入课堂。。对不起that@AndresFelipe那么这是固定的吗?你说的淡入淡出是什么意思?@Vega我不明白你的意思。但是有可能CSS搞乱了。这是一个从引导中丢失的类,淡入…:/有可能是CSS搞乱了。这是一个从引导中丢失的类,淡入…:/