-1
当我使用ng-controller=""
时,它不起作用。角度:ng控制器不工作?
我在我的Web浏览器控制台中出现此错误。有谁能帮助解决这个问题吗?
这是我的HTML代码,我使用的测试。当我删除ng-controller =“”时,angular正在工作,但我无法使用ng-controller =“”作为我的代码。
<!DOCTYPE>
<html ng-app>
\t <head>
\t \t <title>APP</title>
\t \t <!-- Latest compiled and minified CSS -->
\t \t <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
\t \t <!-- Optional theme -->
\t \t <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<script src="controllers/controller.js">
\t </script>
\t \t <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js">
\t \t </script>
\t </head>
\t <body>
\t \t <div class="container" ng-controller="AppCtrl">
\t \t <h1>Users</h1>
\t \t <table class="table">
\t \t \t <thead>
\t \t \t <tr>
\t \t \t <td>Name</td>
\t \t \t <td>Email</td>
\t \t \t <td>ID</td>
\t \t \t </tr>
\t \t \t </thead>
\t \t </table>
\t \t </div>
\t \t <input ng-model="test">
\t \t {{test}}
\t </body>
</html>
你能提供你的控制器的一些例子吗?也许你的网页的HTML,看看你是否错过了别的?像'ng-app'? – JanR
我上传了我的示例html页面。这是我的示例控制器。 (){ }() –