Skip to content

Commit

Permalink
fix(rxSortableColumn): user proper ID to pass function to scope
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The sortMethod of rxSortableColumn was not properly
passing the method to the `scope` with a `&`, but was using a `=`, which
should only be used for two-way bindings.

To migrate the code, follow the example below:

BEFORE:

<rx-sortable-column
    sort-method="sortCol"
    sort-property="name"
    predicate="sort.predicate"
    reverse="sort.reverse">

AFTER:

<rx-sortable-column
    sort-method="sortCol(property)"
    sort-property="name"
    predicate="sort.predicate"
    reverse="sort.reverse">

The method you pass will *always* take `property` as the argument
when assigning it to `sort-method`.

tl;dr: Change every `sort-method="foo"` assignment to
`sort-method="foo(property)"`
  • Loading branch information
parlarjb committed May 14, 2014
1 parent 471e7d2 commit 894805c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/rxSortableColumn/docs/rxSortableColumn.html
Expand Up @@ -4,7 +4,7 @@
<tr>
<th scope="col">
<rx-sortable-column
sort-method="sortCol"
sort-method="sortCol(property)"
sort-property="name"
predicate="sort.predicate"
reverse="sort.reverse">
Expand All @@ -13,7 +13,7 @@
</th>
<th scope="col">
<rx-sortable-column
sort-method="sortCol"
sort-method="sortCol(property)"
sort-property="jobTitle"
predicate="sort.predicate"
reverse="sort.reverse">
Expand All @@ -33,4 +33,4 @@
</tr>
</tbody>
</table>
</div>
</div>
4 changes: 2 additions & 2 deletions src/rxSortableColumn/rxSortableColumn.js
Expand Up @@ -20,7 +20,7 @@ angular.module('encore.ui.rxSortableColumn', [])
templateUrl: 'templates/rxSortableColumn.html',
transclude: true,
scope: {
sortMethod: '=',
sortMethod: '&',
sortProperty: '@',
predicate: '=',
reverse: '='
Expand Down Expand Up @@ -60,4 +60,4 @@ angular.module('encore.ui.rxSortableColumn', [])
};

return util;
});
});
2 changes: 1 addition & 1 deletion src/rxSortableColumn/templates/rxSortableColumn.html
@@ -1,5 +1,5 @@
<div class="rx-sortable-column">
<button class="sort-action btn-link" ng-click="sortMethod(sortProperty)">
<button class="sort-action btn-link" ng-click="sortMethod({property:sortProperty})">
<span class="visually-hidden">Sort by&nbsp;</span>
<span ng-transclude></span>
</button>
Expand Down

0 comments on commit 894805c

Please sign in to comment.