Controller not linking to view

205 views Asked by At

I am trying to build a contact form application, and currently I am stuck on being able to perform a scope function defined in my controller. I currently have nothing being performed by this function aside from a console.log, and that alone is not working. I know the issue does not stem from the file not being included properly.

Here is the app.js:

var app = angular.module('contactFormApp', ['xtForm']);

app.controller('contactFormController', function($scope) {
    $scope.formSubmit = function() {
        console.log('success');
    }
});

I have attempted to link this into the view as follows:

<div ng-controller="contactFormController">
    <form name="contactForm" xt-form role="form" focus-error="true"
              novalidate>
        <div class="row">
            <div class="col-xs-12">
                <div class="form-group">
                    <div class="col-xs-2">
                        <label for="firstName">First Name:</label>
                    </div>
                    <div class="col-xs-4">
                        <input type="text"
                        class="form-control name in-block"
                        ng-model="contactForm.firstName"
                        id="firstName"
                        autocomplete="off"
                        placeholder="First"
                        xt-validation-tooltip
                        required
                        msg-required="Please enter your first name.">
                    </div>
                </div>

And (skipping most of the form) the bottom of the view is written as follows:

        <button type="submit" class="btn btn-lg" ng-click="formSumbit()">Submit</button>
    </form>
</div>
0

There are 0 answers