SoFunction
Updated on 2025-03-10

AngularJS form editing and submission function example


<!-- AngularJS controller -->
<script>
    var formApp = ('formApp', []);
    function formController($scope, $http) {
$ = {'name':'Zhang San','remark':'Remark'};
        $ = function() {
            $http({
                method  : 'POST',
                url     : '/role/edit',
                data    : $.param($),  // pass in data as strings
                headers : { 'Content-Type': 'application/x-www-form-urlencoded' }  // set the headers so angular passing info as form data (not request payload)
            })
                .success(function(data) {
                    (data);
                    if (!) {
                    } else {
                    }
                });
        };
    }
</script>
<!--Complied input adjustment in form-->
<input type="text" name="name" ng-model="" class="form-control" placeholder="Role Name">