Home  >  Article  >  Web Front-end  >  Uncaught Error: [$injector:modulerr]

Uncaught Error: [$injector:modulerr]

黄舟
黄舟Original
2017-02-15 14:56:002663browse

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)!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn