私はAngularJSを初めて使用しています。私は絶対初心者です。フィルタを使ってみました。オブジェクトを直接バインドするのではなく、プロパティにバインドしようとしました。しかしコードは、リストを表示する代わりに{{x.people}}を出力として表示します。私はここで何が欠けているのですか?AngularJS:オブジェクトのプロパティをスコープにバインドする方法
<!DOCTYPE html>
<html>
<head>
<title>ANGULAR APP</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js">
</script>
</head>
<body ng-app="myApp" ng-controller="myFirstController">
<p>Type a letter in the input field:</p>
<p><input type="text" ng-model="test"></p>
<ul>
<li ng-repeat="x in model.people">
{{ x.name }}
</li>
</ul>
</body>
<script>
var app = angular.module('myApp', []);
var myFirstController = function($scope) {
$scope.model = {
people: [{
name: 'Jani',
country: 'Norway'
},
{
name: 'Carl',
country: 'Sweden'
},
{
name: 'Margareth',
country: 'England'
},
{
name: 'Hege',
country: 'Norway'
},
{
name: 'Joe',
country: 'Denmark'
},
{
name: 'Gustav',
country: 'Sweden'
},
{
name: 'Birgit',
country: 'Denmark'
},
{
name: 'Mary',
country: 'England'
},
{
name: 'Kai',
country: 'Norway'
}
];
};
}
app.controller('myFirstController', myFirstController);
</script>
</html>
のようなコントローラーを宣言しようこれは:app.controller( "myFirstController"、function($ scope){あなたのコード}) –
予期しないトークンが40行目にありますか?私はそれを取り除かなければならない。 ? –