Skip to content

Instantly share code, notes, and snippets.

@bl4de
Created October 24, 2017 11:41
Show Gist options
  • Save bl4de/14cb1d7e193e97b0a5cf5d92de7613f2 to your computer and use it in GitHub Desktop.
Save bl4de/14cb1d7e193e97b0a5cf5d92de7613f2 to your computer and use it in GitHub Desktop.
Working AngularJS 1.6.6 breadcrumb component
'use strict';
angular.module('breadcrumb-component', [])
.component('breadcrumb', {
restrict: 'E',
bindings: {
path: '<'
},
controller: class breadcrumbCtrl {
constructor() {}
$onInit() {}
},
template: `
<ol class="breadcrumb">
<li><a href="#!home">Home</a></li>
<li>{{$ctrl.path.screen}}</li>
<li class="active">{{$ctrl.path.active}}</li>
</ol>
`
});
// and how to call it:
```html
<breadcrumb path="vm.path"></breadcrumb>
```
// where vm.path is defined as:
```
vm.path = {
screen: 'Screen name',
active: 'Current active part of breadcrumb'
};
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment