Reputation: 1513
In my Ionic project, in app.js, I wrote some code but it doesn't work when I use the controller in index.html file.
How do I make it work?
app.js:
var app= angular.module('starter', ['ionic']);
app.controller('ListCtrl',function($scope)
{
$scope.notes =
[
{
title:'First note'
description:'This is my first note'
},
{
title:'Second Note'
description:'second note'
}
];
});
index.html:
<body ng-app="starter">
<ion-pane>
<ion-header-bar class="bar-stable">
<h1 class="title">InfoNote</h1>
</ion-header-bar>
<ion-content ng-controller="ListCtrl">
<div class ="list">
<div class ="item" ng-repeat="note in notes" >
{{note.title}}
</div>
</div>
</ion-content>
</ion-pane>
</body>
Upvotes: 1
Views: 690
Reputation: 1036
You forgot comma in your JSON
. In your controller
, try again with this :
app.controller('ListCtrl',function($scope)
{
$scope.notes =
[
{
title:'First note',
description:'This is my first note'
},
{
title:'Second Note',
description:'second note'
}
];
});
Upvotes: 3