wordpress - Why is my AngularJS module never loaded? -


i angularjs newbie, , having difficulty getting angularjs form work correctly. chrome dev tools tells me module not being loaded.

below html; div within wordpress template:

<div ng-app="contact" style="float: left;">     <form method="post" name="form" role="form" ng-controller="contactformcontroller" ng-submit="form.$valid && sendmessage(input)" novalidate>     <p ng-show="success">thanks getting in touch!</p>     <p ng-show="error">something wrong happened!, please try again.</p>     <legend>contact</legend>     <fieldset>     <div>       <label for="name">name:</label>       <input type="text" id="name" name="name" ng-model="input.name" required>     </div>     <div>         <label for="email">email:</label>         <input type="email" id="email" name="email" ng-model="input.email" required>     </div>     <div>         <label for="messsage">message:</label>         <textarea id="messsage" name="message" ng-model="input.message" required></textarea>     </div>     <div>         <label for="honeypot">i promise i'm not bot</label>         <input type="text" id="honeypot" name="honeypot" ng-model="input.honeypot">     </div>     </fieldset>     <button type="submit" name="submit" value="submit">submit</button>     </form>     </div> 

this angular code:

angular.module("contact", [])     .controller("contactformcontroller", ['$scope', '$http', function($scope, $http) {     $scope.success = false;     $scope.error = false;      $scope.sendmessage = function( input ) {         $http({             method: 'post',             url: 'http://alamanceforeducation.org/wp-content/themes/flex/library/scripts/processapplecartform.php',             data: input,             headers: { 'content-type': 'application/x-www-form-urlencoded' }         })             .success( function(data) {                 if ( data.success ) {                     $scope.success = true;                 } else {                     $scope.error = true;                 }             } );     } }]); 

the code adapted tutorial. can me out doing wrong?

there's nothing wrong code in terms of problem having. problem order in loading scripts.

the order should be: 1- angular.js 2- any-angular-dependency.js 3- your-angular-app.js

this working copy of code i'm not including form because show doesn't find angular module because either not including or not loading correctly cdn, might want download have locally , include <script src="angular.js"></script> tag


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -