<div ng-controller="pucdes">
<form name="f1" ng-submit="Savedata(apis)">
<div>
{{mess}}
</div>
<input type="text" name="jjj" ng-class="Submitted?'ng-girty':''" required autofocus />
<span class="Error" ng-show="(f1.jjj.$dirty ||Submitted) && f1.jjj.$error.required">kkkkkkk</span>
{{mess}}
<input type="submit" ng-click="myFunction()" value="Savedata">
<input type="submit" ng-click="myFunction2()" value="Editdata">
</form>
</div>
angular.module("MyApp")
.controller("pucdes", function ($scope, locationder) {
$scope.Savedata = function () {
$scope.Submitted = true;
alert("ppp");
locationder.Sessiondata2($scope.myFunction)
.then(function (d) {
alert('fjfbffbjbf')
$scope.mess = "jjjjjjj.......sucess.......";
})
locationder.Sessiondata($scope.myFunction2)
.then(function (d) {
$scope.mess = "jjjjjjj.......sucess.......";
})
}
})
.factory("locationder", function ($http, $q) {
var fac = {};
fac.Sessiondata2 = function () {
// var defer = $q.defer();
$http({
url: '/Home/pubs3',
method: "POST",
data: JSON.stringify(),
headers: { 'content-type': 'application/json' }
})
}
fac.Sessiondata = function () {
$http({
url: '/Home/pubs2',
method: "POST",
data: JSON.stringify(),
headers: { 'content-type': 'application/json' }
})
}
//return defer.promise;
// }
return fac;
});