i'm new in angularjs, ng-submit give old value after form submit
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
$scope.myTxt = "You have not yet clicked submit";
$scope.sidebarname = "Vendor";
$scope.myFunc = function () {
$scope.myTxt = "You clicked submit!";
alert($scope.sidebarname);
}
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
<form ng-submit="myFunc()">
<input ng-value="sidebarname" type="text">
<input type="submit">
</form>
<p>{{myTxt}}</p>
</div>
after form submit $scope.sidebarname give old value Vendor , i have read and search about it but nothing helpful.
any help or suggestion will be helpful