Skip to content

Commit

Permalink
feat(angular): supports per field abilities
Browse files Browse the repository at this point in the history
stalniy committed May 14, 2018
1 parent 6fe5cd3 commit 8268bb4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/casl-angular/src/can.js
Original file line number Diff line number Diff line change
@@ -16,16 +16,16 @@ export class CanPipe {
this.unsubscribeFromAbility = noop;
}

transform(resource, action) {
transform(resource, action, field) {
if (this.unsubscribeFromAbility === noop) {
this.unsubscribeFromAbility = this.ability.on('updated', () => this.cd.markForCheck());
}

return this.can(action, resource);
return this.can(action, resource, field);
}

can(action, resource) {
return this.ability.can(action, resource);
can(action, resource, field) {
return this.ability.can(action, resource, field);
}

ngOnDestroy() {

0 comments on commit 8268bb4

Please sign in to comment.