Issue
we have more than one page each page have forms. in Page 1 When i entered some data in one form and click on submit and navigate to another page 2, in that page2 i entered data to some fields and i navigating back to page 1 and i click on submit in page 1 and navigating to page 2 in that time the fields are not cleared. i need to clear the form fields using angularjs any one please help.
We are facing issue like below
We need like this below
Solution
The problem is with the cache-view, you can disable the cache with cache-view="false"
or you can clean the fields manually using the enter event $ionicView.enter
.
Is up to you where to disable the cache, eg.
Disable cache within state provider
$stateProvider.state('myState', {
cache: false,
url : '/myUrl',
templateUrl : 'my-template.html'
})
Disable cache with an attribute
<ion-view cache-view="false" view-title="My Title!">
...
</ion-view>
If you want to clean the fields manually, you will have to do something like this in your controller:
$scope.$on('$ionicView.enter', function() {
$scope.field1 = '';
$scope.field2 = '';
$scope.field3 = '';
});
Answered By - Hosar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.