primeng icon indicating copy to clipboard operation
primeng copied to clipboard

p-breadcrumb is not working properly if Observable<string[]> is provided in <li *ngFor>

Open joe380 opened this issue 10 years ago • 1 comments

Then using p-breadcrum with a simple array of elements where x is string[]: <p-breadcrumb><ul><li *ngFor="let p of x"><span>{{p}}</span></li></ul></p-breadcrumb> all

  • elements have proper classes and also the first li[fa-home] is generated

    Change the x variable to Observable<string[]> and the first first li[fa-home] is missing and all other

  • elements are missing classes + also the characters '>' between each string are missing.

    joe380 avatar May 13 '16 14:05 joe380
  • Breadcrumb is reimplemented as a native component in beta6 and this is fixed as a result. There is a new menu model api so instead of generating markup yourself, the component will do it and update it according to changes.

    <p-breadcrumb [model]="items"></p-breadcrumb>
    
    export class BreadcrumbDemo implements OnInit {
    
        private items: MenuItem[];
    
        ngOnInit() {
            this.items = [];
            this.items.push({label:'Categories'});
            this.items.push({label:'Sports'});
            this.items.push({label:'Football'});
            this.items.push({label:'Countries'});
            this.items.push({label:'Spain'});
            this.items.push({label:'F.C. Barcelona'});
            this.items.push({label:'Squad'});
            this.items.push({label:'Lionel Messi', url: 'https://en.wikipedia.org/wiki/Lionel_Messi'});
        }
    }
    

    cagataycivici avatar May 14 '16 10:05 cagataycivici