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 ?
AngularJS is a JavaScript framework. It can be added to an HTML page with a <script> tag. AngularJS extends HTML attributes with Directives, and binds data to HTML with Expressions.
The typeof Operator You can use the JavaScript typeof operator to find the type of a JavaScript variable.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With