Breadcrumbs in custom pages/widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2017 08:50 AM
Hi SNC,
Would like to know how to add breadcrumbs in custom pages. We have 2 pages mypage1 and mypage2
page2 is opened when we click on page1
So we want home->page1->page2
Thanks
- Labels:
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2017 09:02 AM
Does the OOB breadcrumb widget not work when you add it to the custom page?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2017 09:15 AM
no
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2017 11:36 AM
By no, do you mean that it doesn't display anything or what it displays is not what's expected. Or are there any errors?
The breadcrumbs widget itself is really simple. It listens for a broadcast (sp.update.breadcrumbs) of an object to display the crumbs. The object should contain two properties "url" and "label". Url is going to be the url for the href attribute and label's value will be used for the text that's displayed in the breadcrumb.
Knowing that, you should be able to pull the breadcrumb widget on your custom page. Then in any other widget on the same page in the client controller script broadcast sp.update.breadcrumbs with the needed data. Something similar to this:
$rootScope.$broadcast('sp.update.breadcrumbs', [{url: 'sp?id=some_cool_page', label: 'My Cool Page'}])