angularjs - Angular.js app not working with CDN -
i have checked similar questions , found common issues (script tags not being closed etc) , cannot find reason why i'm still getting "module 'myapp' not available! either misspelled module name or forgot load it. if registering module ensure specify dependencies second argument." error. ideas?
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.js"></script> </head> <body> <form action="functions.php?action=edituser" ng-app="myapp" ng-controller="myctrl"> <p>user id: <span id="userid" ng-model="userid"><?php echo $_get['userid']; ?></span></p> <label>first name </label><input id="firstname" name="firstname" ng-model="firstname"><br/><br/> <label>last name </label><input id="lastname" name="lastname" ng-model="lastname"><br/><br/> <label>e-mail address </label><input id="email" name="email" ng-model="email"><br/><br/> <label>cellphone number </label><input id="cell" name="cell" ng-model="cell"><br/><br/> <label>domain </label><input id="companydomain" name="companydomain" ng-model="companydomain"><br/><br/> <label>id number </label><input id="said" name="said" ng-model="said"><br/><br/> <label>tfa method </label><select id="tfamethod" name="tfamethod" ng-model="tfamethod"> <option id="gauth" value="gauth">google authenticator</option> <option id="sms" value="sms">sms</option> <option id="email" value="email">e-mail</option> </select><br/><br/> <label>reset password? </label><input id="passreset" name="passreset" ng-model="passreset" type="checkbox" value="expire password?"/><br/><br/> </form> <script> var xmlhttp = new xmlhttprequest(); var app = angular.module('myapp', []); xmlhttp.onreadystatechange = function () { if (this.readystate == 4 && this.status == 200) { var response = this.responsetext; var myobj = json.parse(response); app.controller('myctrl', function ($scope) { $scope.firstname = myobj.firstname; $scope.lastname = myobj.lastname; $scope.email = myobj.email; $scope.cell = myobj.cell; $scope.domainname = myobj.domainname; $scope.tfamethod = myobj.tfamethod; $scope.said = myobj.said; }); } }; xmlhttp.open("get", "functions.php?action=getuserdata&id=" + {{userid}}, true); xmlhttp.send(); </script> </body> </html>
you need go through angularjs documentation. enter link description here
add ng-app="myapp"
in html / body tag.
<html ng-app="myapp">
Comments
Post a Comment