試圖在html中顯示範圍 - angularJS/ionic 嘗試在我的網頁上顯示標題,但沒有顯示任何內容。我對角和離子框架相當陌生。如果任何人都可以指出我做錯了什麼,這將有助於一噸!試圖在html中顯示範圍 - angularJS/ionic
這裏是我的控制器JS:
angular.module('MyApp', [])
.controller('TodoCtrls', function($scope) {
$scope.tasks = [
{ title: 'Collect coins' },
{ title: 'Eat mushrooms' },
{ title: 'Get high enough to grab the flag' },
{ title: 'Find the Princess' }
];
})
而且我的html:
<html ng-app="MyApp">
<ion-header>
<ion-navbar>
<ion-title>Courses</ion-title>
<h1 class="title">Todo</h1>
</ion-navbar>
</ion-header>
<script src="TodoCtrl.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body ng-app="MyApp" ng-controller="TodoCtrls">
<ion-content>
<ion-list>
<ion-item ng-repeat="task in tasks">
<h1>{{task.title}}</h1><br>
</ion-item>
</ion-list>
</ion-content>
</body>
</html>
你得到它的工作? :) –