angular-app/angular-app — pull request #82 by petebacondarwin (2012-11-13 23:37:29+00:00)
Title: refact(crud-edit): Use crud-edit directive rather than crudEditMethods

Try again! What this means is that you can simply apply the crud-edit directive to your form and it automagically set everything up for you.

```

...

```

Where user is an expression to the resource object on the scope. (So in your controller you have to add the resource object to the scope.

```
function($scope, user) {
$scope.user = user;
}
```

You can specify the callbacks as expressions to be executed in attributes: on-save, on-remove and on-error.

If you do not specify them as attributes then it looks for onSave, onRemove and onError methods on the scope. If they are not there then it falls back further - onRemove -> onSave, etc. Eventually falling back to a noop.

```

...

```

```
function($scope) {
$scope.onSave = angular.noop;
$scope.onRemove = $scope.onSave();
$scope.onError = angular.noop;
}
```