방금 앵귤러 JS (버전 1)로 시작하여 보간을 올바르게 실행할 수 없었습니다. 나는 이미 해결 된 버전으로 그것을 점검했고, 나에게 잘 보인다. 나는 심지어 컨트롤러 안쪽에 console.log를 두었고 아무것도 인쇄하지 않았다. 도와주세요. index.html을Beginner Angular JS app, interpolation not working
<!doctype html>
<html lang="en" np-app="LunchCheck">
<head>
<meta charset="utf-8">
<script src="angular.min.js"></script>
<script src="app.js"></script>
<title>Lunch Checker</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles/bootstrap.min.css">
<style>
.message { font-size: 1.3em; font-weight: bold; }
</style>
</head>
<body>
<div class="container" ng-controller="LunchCheckController">
<h1>Lunch Checker</h1>
<div class="form-group">
<input id="lunch-menu" type="text"
placeholder="list comma separated dishes you usually have for lunch"
class="form-control" ng-model="food">
Content is: {{food}}
</div>
</div>
</body>
</html>
는
(function(){
'use strict';
angular.module('LunchCheck', [])
.controller('LunchCheckController', LunchCheckController);
LunchCheckController.$inject = ['$scope'];
function LunchCheckController($scope){
console.log("In controller");
$scope.food = 'Enter something';
}
})();
당신은 ng-app 대신에 np-app = "LunchCheck"를 작성했습니다 –