【发布时间】:2017-11-11 07:16:53
【问题描述】:
尝试在 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>
【问题讨论】:
-
你让它工作了吗? :)
标签: javascript html angularjs ionic-framework angularjs-scope