Skip to content

Commit

Permalink
fix ncuillery#20: when a scope variable is updated, the related label…
Browse files Browse the repository at this point in the history
… is updated
  • Loading branch information
Sileghem Thomas committed Jun 23, 2014
1 parent 7994afb commit bb893cd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
18 changes: 12 additions & 6 deletions dist/angular-breadcrumb.js
@@ -1,8 +1,8 @@
/*! angular-breadcrumb - v0.2.1-dev-2014-06-13
* https://github.com/ncuillery/angular-breadcrumb
* Copyright (c) 2014 Nicolas Cuillery; Licensed MIT */

(function (window, angular, undefined) {
/*! angular-breadcrumb - v0.2.1-dev-2014-06-23
* https://github.com/ncuillery/angular-breadcrumb
* Copyright (c) 2014 Nicolas Cuillery; Licensed MIT */

(function (window, angular, undefined) {
function isAOlderThanB(scopeA, scopeB) {
if(angular.equals(scopeA.length, scopeB.length)) {
return scopeA > scopeB;
Expand Down Expand Up @@ -184,6 +184,12 @@ function BreadcrumbDirective($interpolate, $breadcrumb, $rootScope) {
angular.forEach(scope.steps, function (value) {
if (value.data && value.data.ncyBreadcrumbLabel) {
var parseLabel = $interpolate(value.data.ncyBreadcrumbLabel);

viewScope.$watch(parseLabel, function(newParsed){
console.log('parse', newParsed)
});


value.ncyBreadcrumbLabel = parseLabel(viewScope);
} else {
value.ncyBreadcrumbLabel = value.name;
Expand All @@ -207,4 +213,4 @@ BreadcrumbDirective.$inject = ['$interpolate', '$breadcrumb', '$rootScope'];
angular.module('ncy-angular-breadcrumb', ['ui.router.state'])
.provider('$breadcrumb', $Breadcrumb)
.directive('ncyBreadcrumb', BreadcrumbDirective);
})(window, window.angular);
})(window, window.angular);
4 changes: 3 additions & 1 deletion src/angular-breadcrumb.js
Expand Up @@ -179,7 +179,9 @@ function BreadcrumbDirective($interpolate, $breadcrumb, $rootScope) {
angular.forEach(scope.steps, function (value) {
if (value.data && value.data.ncyBreadcrumbLabel) {
var parseLabel = $interpolate(value.data.ncyBreadcrumbLabel);
value.ncyBreadcrumbLabel = parseLabel(viewScope);
viewScope.$watch(parseLabel, function(newParsedLabel){
value.ncyBreadcrumbLabel = newParsedLabel;
});
} else {
value.ncyBreadcrumbLabel = value.name;
}
Expand Down

0 comments on commit bb893cd

Please sign in to comment.