How to send a new object and also clear $ anchor.task?

Using AngularJS , how can I set the Submit button , update the current one and also clear the identifier of the binding - I basically want to quickly add entries, but always change the form of adding to the editing form.

Here is my current div that is not working, it seems to be ignoring $anchor.task=null...

Please note that the Add New button works fine!

<div>
    Description: <input name="task.desc" ng-required><br>
    <a href="#" ng-action="task.$save(); $anchor.task=null">Save</a>
    <input type="button" value="Add New" ng-action="$anchor.task=null">
</div>
+5
source share
1 answer

If you want to have quick uploads, this is what you need to change.

, : ng-entity = "task = Task" . ng-entity = "", , . . http://docs.getangular.com/Ng-entity. , ng-init.

"" Task : ()

: (). $save()

, , reset . , $save(): (). $Save ({: $root.task = {};})

$root , , ​​.

<div ng-entity="Task" ng-init="task={}">
        Description: <input name="task.desc" ng-required><br>
        <a href="#" ng-action="Task(task).$save({: $root.task={} })">Save</a>
</div>
+4

All Articles