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

Uncaught Error: [$injector:modulerr]

黄舟
Release: 2017-02-15 14:56:00
Original
2709 people have browsed it

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>
Copy after login

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>
Copy after login

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template