Skip to content

Commit a8e58e3

Browse files
author
Jens Melgaard
committed
Fix alias so that the root alias is keept
1 parent 8dd225d commit a8e58e3

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/directives/dxTree.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,19 @@
2121
var exp = attr['dxStartWith'] || attr.root,
2222
match = exp.match(SW_REGEX),
2323
watch = match[1],
24-
priorAlias = match[3] || '';
24+
alias = match[3] || '';
2525

2626
return function $RootNodeDirectiveLink(scope, elm, attr, ctrl, $transclude) {
27+
ctrl.alias = alias;
2728
ctrl.transclude = $transclude;
2829
ctrl.transclude(scope, function (clone, scope) {
2930
elm.append(clone);
3031
scope.$dxLevel = 0;
3132
scope.$dxIsRoot = true;
3233
function updatePrior(value) {
3334
scope.$dxPrior = value;
34-
if (priorAlias !== '') {
35-
scope[priorAlias] = value;
35+
if (alias !== '') {
36+
scope[alias] = value;
3637
}
3738
}
3839
scope.$watch(watch, updatePrior);
@@ -52,21 +53,19 @@
5253
multiElement: true,
5354

5455
compile: function (elm, attr) {
55-
var exp = attr['dxConnect'] || attr.connect,
56-
match = exp.match(SW_REGEX),
57-
watch = match[1],
58-
priorAlias = match[3] || '';
56+
var watch = attr['dxConnect'] || attr.connect;
5957

6058
return function $NodeDirectiveLink(scope, elm, attr, ctrl) {
59+
alias = ctrl.alias || '';
6160
ctrl.transclude(scope, function (clone, scope) {
6261
elm.append(clone);
6362

6463
scope.$dxLevel = scope.$dxLevel + 1;
6564
scope.$dxIsRoot = false;
6665
function updatePrior(value) {
6766
scope.$dxPrior = value;
68-
if (priorAlias !== '') {
69-
scope[priorAlias] = value;
67+
if (alias !== '') {
68+
scope[alias] = value;
7069
}
7170
}
7271

0 commit comments

Comments
 (0)