I'm learning AngularJS and I didn't understand that problem on Google Chrome and Opera. When I run this code Firefox, it works fine. If you have any idea for this issue, I will be happy.
My AngularJs Code like this in app.js file
(function(){
var jsonDataServiceUrl = 'http://jsonplaceholder.typicode.com/todos';
var app = angular.module('todoApp',[]);
app.controller('TodoController',['$http',function($http){
var todo = this;
todo.items = [];
//Get json data
$http.get(jsonDataServiceUrl).success(function(data){
todo.items = data;
});
}]);
app.directive("todoItems",function(){
return {
restrict: 'AE',
templateUrl: 'todo-items.html',
};
});
})();
and my main html file like that
<!DOCTYPE html>
<html ng-app="todoApp">
<head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
</head>
<body ng-controller="TodoController as todo">
<ul class="list-group">
<li class="list-group-item" ng-repeat="item in todo.items" ng-class="{'list-group-item-success':item.completed}" >
<todo-items></todo-items>
</li>
</ul>
<!-- AngularJS v1.5.6 -->
<script type="text/javascript" src="js/angular.min.js"></script>
<script type="text/javascript" src="js/app.js"></script>
</body>
</html>
and my todo-items.html file like that
<span class="badge">{{item.completed}}</span>
{{item.title}}
And json data type like that
{
"userId": 1,
"id": 1,
"title": "delectus aut autem",
"completed": false
}
But when I run this code on Google Chrome it looks like that
Google Chrome Result Screenshot
And it works on Firefox