Home > Article > Web Front-end > Uncaught Error: [$injector:modulerr]
1. Error description
#2. Error reason
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script> </head> <body> <p ng-app="app" ng-controller="appCon"> <input type="text" ng-model="username" /> <label>{{username}}</label> </p> </body> </html>
When writing the ng-model instruction instance in AngularJS, ng-controller was added, and this error occurred when previewing the page; remove the ng-controller instruction , this error will not be reported.
The error is caused by incorrect use of the ng-controller directive. There cannot be a value in the ng-app directive
3. Solution
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script> </head> <body> <p ng-app=""> <input type="text" ng-model="username" /> <label>{{username}}</label> </p> </body> </html>Remove the ng-controller directive and use ng-app Leave the command value blank
The above is the content of Uncaught Error: [$injector:modulerr]. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!