<form>
<h4>Tutorial</h4>
<hr />
<div>
<label for="title">Title</label>
<div>
<input type="text" data-ng-model="tutorial.title" />
</div>
</div>
<div>
<label for="description">Description</label>
<div>
<textarea data-ng-model="tutorial.description">
</textarea>
</div>
</div>
<div>
<label for="attachment">Attachment</label>
<div>
<input type="file" data-ak-file-model="tutorial.attachment" />
</div>
</div>
<div>
<div>
<input type="button" value="Save" data-ng-click="saveTutorial(tutorial)" />
</div>
</div>
</form>
service:
"use strict";
(function () {
angular.module("application")
.factory("entityService", ["akFileUploaderService", function (akFileUploaderService) {
var saveTutorial = function (tutorial) {
return akFileUploaderService.saveModel(tutorial, "/controllerName/actionName");
};
return {
saveTutorial: saveTutorial
};
}]);
})();
controller(js):
"use strict";
(function () {
angular.module("application")
.controller("homeCtrl", ["$scope", "entityService",
function ($scope, entityService) {
$scope.saveTutorial = function (tutorial) {
entityService.saveTutorial(tutorial)
.then(function (data) {
console.log(data);
});
};
}]);
})();
MVC Controller Action: