as the title says I'm trying to display an Angular variable in a html page. I have this function inside the controller I'm using :
$http.get('/api/tasks/?format=json').success(function(data) {
$scope.tasks = data;
for (var i=0; i < $scope.tasks.results.length; i++)
{
if ($scope.tasks.results.status == 0)
{
tobedone++;
}
}
});
And now I'd like to display tobedone
inside my html page. I've tried [[tobedone]] (I'm using Django, thus custom providers), but nothing displays. Any help please ?
This question is related to
angularjs
In your template, you have access to all the variables that are members of the current $scope
. So, tobedone
should be $scope.tobedone
, and then you can display it with {{tobedone}}
, or [[tobedone]]
in your case.
Source: Stackoverflow.com