Deka87 Deka87 - 3 months ago 6
AngularJS Question

Angular $scope value won't show up on a page

I am starting to learn Angular and tried to repeat the "To do list" task they have on the homepage. However, I am stuck in the very beginning:


<div ng-app>
<div ng-controller="TodoCtrl">


function TodoCtrl($scope) {
$scope.totalItems = 4;

I seem to do the very same thing, however it doesn't work. What's wrong?


First you must import the angular library, then instantiate your app and finally create your controller, this way:

angular.module('app', [])
  .controller('TodoCtrl', function($scope) {
    $scope.totalItems = 4;
<html ng-app="app">

  <script src=""></script>

<body ng-controller="TodoCtrl">


I recommend you to check this: What is a Module?