Join the Stack Overflow Community
Stack Overflow is a community of 6.4 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I've been working through this tutorial https://ionicframework.com/docs/guide/building.html and I'm stuck without the list showing up when I test it. It shows the header with "Todo" (as seen in the link) but there is no list.

The console from the web server (when running ionic serve in the mac terminal) gives me the error Uncaught ReferenceError: angular is not defined at [local web server]. It also does not show up when emulating on iOS or Android.

Here is my index.html:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title>Todo</title>

    <link rel="manifest" href="manifest.json">
    <script src="js/app.js"></script>
    <!-- un-comment this code to enable service worker
    <script>
      if ('serviceWorker' in navigator) {
        navigator.serviceWorker.register('service-worker.js')
          .then(() => console.log('service worker installed'))
          .catch(err => console.log('Error', err));
      }
    </script>-->

    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
    <link href="css/ionic.app.css" rel="stylesheet">
    -->

    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>

    <!-- your app's js -->
    <script src="js/app.js"></script>
  </head>
  <body ng-app="todo" ng-controller="TodoCtrl">
     <ion-side-menus>

<!-- Center Content -->
    <ion-side-menu-content>
        <ion-header-bar class="bar-dark">
       <h1 class="title">Todo</h1>
    <ion-header-bar>
    <ion-content>
       <!-- our list and list items -->
       <ion-list>
          <ion-item ng-repeat="task in tasks">
        {{task.title}}
          </ion-item>
       </ion-list>
    </ion-content>
    </ion-side-menu-content>

    <!--Left Menu-->
    <ion-side-menu side="left">
    <ion-header-bar class="bar-dark">
       <h1 class="title">Projects</h1>
    </ion-header-bar>
    </ion-side-menu>
  </ion-side-menus>
    <ion-pane>
      <ion-header-bar class="bar-stable">
        <h1 class="title">Todo</h1>
      </ion-header-bar>
      <ion-content>

      </ion-content>
    </ion-pane>
  </body>
</html>

app.js:

// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
angular.module('starter', ['ionic'])
angular.module('todo', ['ionic'])


    .run(function($ionicPlatform) {
      $ionicPlatform.ready(function() {
        if(window.cordova && window.cordova.plugins.Keyboard) {
          // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
          // for form inputs)
          cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

          // Don't remove this line unless you know what you are doing. It stops the viewport
          // from snapping when text inputs are focused. Ionic handles this internally for
          // a much nicer keyboard experience.
          cordova.plugins.Keyboard.disableScroll(true);
        }
        if(window.StatusBar) {
          StatusBar.styleDefault();
        }
      });
    })

    .controller('TodoCtrl', function($scope) {
       $scope.tasks = [
            { title: 'Collect coins' },
            { title: 'Eat muchrooms' },
            { title: 'Get high enough to grab the flag' },
            { title: 'Find the Princess' }
       ];
    })

From what I understand, this is all the code that I need to modify at this point. I've searched the error above, but I haven't been able to resolve it yet.

Any ideas??

Thanks!

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.