Skip to main content
angular.module('App').controller('UserProfileController', function($rootScope, $scope, $http, $timeout) {
    $scope.$on('$viewContentLoaded', function() {
        App.initAjax(); // initialize core components
        Layout.setSidebarMenuActiveLink('set', $('#sidebar_menu_link_profile')); // set profile link active in sidebar menu
        $scope.form.txt;
    });

    // set sidebar closed and body solid layout mode
    $rootScope.settings.layout.pageBodySolid = true;
    $rootScope.settings.layout.pageSidebarClosed = true;

    $scope.Submit = function() {
       alert($scope.form.txt);
     }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.min.js"></script>
<form role="form" action="#" ng-submit="Submit()">
                            <div class="form-group">
                                <label class="control-label">First Name</label>
                                <input type="text" ng-model="form.txt" placeholder="John" class="form-control" /> </div>
                                <div class="margiv-top-10">
                                <a input type="submit" id="submit"  ngClick="Submit()"  class="btn green-haze"> Save Changes </a>
                                
                            </div>
                        </form>
                            

O meu controller esta :

angular.module('App').controller('UserProfileController', function($rootScope, $scope, $http, $timeout) {
    $scope.$on('$viewContentLoaded', function() {
        App.initAjax(); // initialize core components
        Layout.setSidebarMenuActiveLink('set', $('#sidebar_menu_link_profile')); // set profile link active in sidebar menu
        $scope.form.txt;
    });

    // set sidebar closed and body solid layout mode
    $rootScope.settings.layout.pageBodySolid = true;
    $rootScope.settings.layout.pageSidebarClosed = true;

    $scope.Submit = function() {
       alert($scope.form.txt);
     }
});
<form role="form" action="#" ng-submit="Submit()">
                            <div class="form-group">
                                <label class="control-label">First Name</label>
                                <input type="text" ng-model="form.txt" placeholder="John" class="form-control" /> </div>
                                <div class="margiv-top-10">
                                <a input type="submit" id="submit"  ngClick="Submit()"  class="btn green-haze"> Save Changes </a>
                                
                            </div>
                        </form>
                            

O meu controller esta :

angular.module('App').controller('UserProfileController', function($rootScope, $scope, $http, $timeout) {
    $scope.$on('$viewContentLoaded', function() {
        App.initAjax(); // initialize core components
        Layout.setSidebarMenuActiveLink('set', $('#sidebar_menu_link_profile')); // set profile link active in sidebar menu
        $scope.form.txt;
    });

    // set sidebar closed and body solid layout mode
    $rootScope.settings.layout.pageBodySolid = true;
    $rootScope.settings.layout.pageSidebarClosed = true;

    $scope.Submit = function() {
       alert($scope.form.txt);
     }
});
angular.module('App').controller('UserProfileController', function($rootScope, $scope, $http, $timeout) {
    $scope.$on('$viewContentLoaded', function() {
        App.initAjax(); // initialize core components
        Layout.setSidebarMenuActiveLink('set', $('#sidebar_menu_link_profile')); // set profile link active in sidebar menu
        $scope.form.txt;
    });

    // set sidebar closed and body solid layout mode
    $rootScope.settings.layout.pageBodySolid = true;
    $rootScope.settings.layout.pageSidebarClosed = true;

    $scope.Submit = function() {
       alert($scope.form.txt);
     }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.min.js"></script>
<form role="form" action="#" ng-submit="Submit()">
    <div class="form-group">
        <label class="control-label">First Name</label>
        <input type="text" ng-model="form.txt" placeholder="John" class="form-control" /> </div>
        <div class="margiv-top-10">
        <a input type="submit" id="submit"  ngClick="Submit()"  class="btn green-haze"> Save Changes </a>

    </div>
</form>
Fonte Link
Augusto Furlan
  • 1,2mil
  • 1
  • 12
  • 30

Angular formulario submit

Pessoal estou usando o metronic com angular e tenho o controller tudo certo, porem tentei criar uma função que exibe oq o usuario digitou em um campo em um alert (futuramente irei filtrar)...

arquivo HTML :

<form role="form" action="#" ng-submit="Submit()">
                            <div class="form-group">
                                <label class="control-label">First Name</label>
                                <input type="text" ng-model="form.txt" placeholder="John" class="form-control" /> </div>
                                <div class="margiv-top-10">
                                <a input type="submit" id="submit"  ngClick="Submit()"  class="btn green-haze"> Save Changes </a>
                                
                            </div>
                        </form>
                            

O meu controller esta :

angular.module('App').controller('UserProfileController', function($rootScope, $scope, $http, $timeout) {
    $scope.$on('$viewContentLoaded', function() {
        App.initAjax(); // initialize core components
        Layout.setSidebarMenuActiveLink('set', $('#sidebar_menu_link_profile')); // set profile link active in sidebar menu
        $scope.form.txt;
    });

    // set sidebar closed and body solid layout mode
    $rootScope.settings.layout.pageBodySolid = true;
    $rootScope.settings.layout.pageSidebarClosed = true;

    $scope.Submit = function() {
       alert($scope.form.txt);
     }
});

Alguem sabe como arrumar ? Obg