Problem p-breadcrumb after update to beta6

UI Components for Angular
Post Reply
manang85
Posts: 30
Joined: 12 May 2016, 19:53

18 May 2016, 11:11

Hi all
I have the following error:
EXCEPTION: Error: Uncaught (in promise): EXCEPTION: Error in app/pages/searchPage.html:1:4
ORIGINAL EXCEPTION: No provider for Router!
I can resolve the issue if I delete from the page the p-breadcrumb part.

Code: Select all

<p-breadcrumb>
        <ul>
            <li><a nohref  (click)="goToPage('/index')"><span>Index</span></a></li>
            <li><a nohref  (click)="goToPage('/searchPage')"><span>Search Page</span></a></li>
        </ul>
    </p-breadcrumb>
With primeng beta5 i did not have this kind of error.
Could you help me?
Thank you
Angelo

User avatar
DarthMaul
Posts: 582
Joined: 23 Nov 2015, 21:20

18 May 2016, 14:19

Hi,

With beta6 all the menu components are now native.Please check the documentation again.

http://primefaces.org/primeng/#/breadcrumb

Limarson
Posts: 3
Joined: 17 May 2016, 08:17

18 May 2016, 14:23

Unfortunately the new menu relies on the deprecated beta router. As for this, you have to import the providers and set it as a provider somewhere in the app:

import {ROUTER_PROVIDERS} from '@angular/router-deprecated';

@Component({
[...]
providers : [ROUTER_PROVIDERS]
})

Then it'll work as expected.

Limarson
Posts: 3
Joined: 17 May 2016, 08:17

18 May 2016, 14:25

Unfortunately, the new menu components rely on the deprecated Beta Router. As for this, you have to import the deprecated Router somewhere in your application and make the provider available:

import {ROUTER_PROVIDERS} from '@angular/router-deprecated';
@Component({
[...]
providers : [ROUTER_PROVIDERS]
})

manang85
Posts: 30
Joined: 12 May 2016, 19:53

18 May 2016, 16:08

Hi,
my http template is :

Code: Select all

<p-breadcrumb [model]="items"></p-breadcrumb>
my controller class is:

Code: Select all

import {Breadcrumb,MenuItem} from 'primeng/primeng';

@Component({
	templateUrl: 'app/pages/searchPage.html',
	selector: 'my-app',
    directives: [InputText, DataTable, Button,
    Column, Calendar, SelectButton, Breadcrumb],
	providers: [VRepWInstanceService]
})

export class SearchPage {
 constructor() {   

        this.items = [];
        this.items.push({label:'Index'});
        this.items.push({label:'Sports'});
        
        
    }
}
Where is my error?
Thank you very much
Angelo

User avatar
DarthMaul
Posts: 582
Joined: 23 Nov 2015, 21:20

18 May 2016, 16:22

Try like this.

Code: Select all

export class SearchPage implements OnInit {

   private items: MenuItem[];

   ngOnInit() {
        this.items = [];
        this.items.push({label:'Index'});
        this.items.push({label:'Sports'});
    }
        
 }

manang85
Posts: 30
Joined: 12 May 2016, 19:53

18 May 2016, 17:28

no, nothing.

thanks for your answer.

Angelo

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

19 May 2016, 00:03

Have you added Limarson's suggestion?

manang85
Posts: 30
Joined: 12 May 2016, 19:53

19 May 2016, 10:25

Good morning
I didn't see the Limarson's suggestion.
I tried with that suggestion and now the breadcrumb is ok.

Thank you very much
Angelo

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 19 guests