AngularJS Sample Application - 3

AngularJS Sample Student Application


var mainApp = angular.module("mainApp", []);

mainApp.controller('studentController', function ($scope) {
    $scope.student = {
        firstName: "",
        lastName: "",
        email: ""
    };

    $scope.reset = function () {
        $scope.student.firstName = "";
        $scope.student.lastName = "";
        $scope.student.email = "";
    };
    $scope.reset();
    $scope.users = [];
    $scope.addUser = function () {
        console.log($scope.student);
        $scope.users.push({
            firstName: $scope.student.firstName,
            lastName: $scope.student.lastName,
            email: $scope.student.email
        });
        $scope.reset();
    };
});
AngularJS Sample Application - 3 AngularJS Sample Application - 3 Reviewed by Bhaumik Patel on 6:26 AM Rating: 5