I have a two field form and i want to just change the tab while submission of form and the problem is since the page is not reloading the form remains as same as previously entered.
Here is my form
<form name="userForm" ng-submit='manageBed.addBed(bedData);' ng-hide="manageBed.loader">
manageBed is the controller tried with
$scope.userForm.$setPristine();
and also clearing bedData this.bedData={};
in controller gives that required field error.
this.addBed = function(bedData) {
Admin.addBed(this.bedData).then(function(data) {
if (data.data.success) {
app.loader = true;
$timeout(function() {
app.loader = false;
$scope.myTabIndex = 0;
Admin.viewBed().then(function(data) {
if (data.data.success) {
$scope.beds = data.data.beds;
} else {
$scope.nobed = true;
}
});
app.bedData = {};
$location.path('/admin/managebeds');
}, 3000);
} else {
app.loader = false;
}
});
};