0
votes

HI there getting this error

ionic.bundle.js:13443 Uncaught Error: [$injector:modulerr] Failed to instantiate module starter due to: Error: [$injector:modulerr] Failed to instantiate module starter.controllers due to: Error: [$injector:nomod] Module 'starter.controllers' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

Controller.js

 angular.module('starter.controllers', [])

.controller('NewCtrl', function($scope) {})

.controller('LoginCtrl', function($scope, Chats) {

})

.controller('CameraCtrl', function($scope, $cordovaCamera) {

  document.addEventListener("deviceready", function () {

    var options = {
      quality: 50,
      destinationType: Camera.DestinationType.DATA_URL,
      sourceType: Camera.PictureSourceType.CAMERA,
      allowEdit: true,
      encodingType: Camera.EncodingType.JPEG,
      targetWidth: 100,
      targetHeight: 100,
      popoverOptions: CameraPopoverOptions,
      saveToPhotoAlbum: false,
      correctOrientation:true
    };

     $cordovaCamera.getPicture(options).then(function(imageData) {
       var image = document.getElementById('myImage');
       image.src = "data:image/jpeg;base64," + imageData;
    }, function(err) {
      // error
    });

  }, false);
});

.controller('OrderDetailCtrl', function($scope, $stateParams) {

})
.controller('ProcessCtrl', function($scope, $stateParams) {

})

.controller('DoneCtrl', function($scope) {

});

app.js

angular.module('starter', ['ionic','starter.controllers', 'starter.services'])

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

}
if (window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleDefault();
    }
  });
})

.config(function($stateProvider, $urlRouterProvider) {
    .state('tab', {
    url: '/tab',
    abstract: true,
    templateUrl: 'templates/tabs.html'
  })

  .state('tab.dash', {
    url: '/new-order',
    views: {
      'tab-new': {
        templateUrl: 'templates/new-order.html',
        controller: 'NewCtrl'
       }
     }
  })

  .state('tab.chats', {
      url: '/in-process',
      views: {
        'tab-inprocess': {
          templateUrl: 'templates/process.html',
          controller: 'ProcessCtrl'
        }
      }
    })
    .state('tab.chat-detail', {
      url: '/new-order/id',
      views: {
        'tab-new': {
           templateUrl: 'templates/order-detail.html',
           controller: 'OrderDetailCtrl'
        }
       }
    })
    .state ('login',{
       url: '/login',
       templateUrl: 'templates/login.html',
       controller: 'LoginCtrl'
    })

    .state ('camera',{
      url:'/camera',
      controller:'CameraCtrl'
    })

  .state('tab.account', {
     url: '/done',
        views: {
        'tab-done': {
        templateUrl: 'templates/done.html',
        controller: 'DoneCtrl'
       }
      }
   });

  // if none of the above states are matched, use this as the fallback
  $urlRouterProvider.otherwise('/login');

});

index.html

    <!-- 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/controllers.js"></script>
    <script src="js/services.js"></script>
    <script src="js/app.js"></script>

    </head>
    <body ng-app="starter">
1
You have to load in your dependencies (in this case your controllers.js) before your app script. So just load in the app.js last.devqon

1 Answers

0
votes

You have to load in your dependencies (in this case your controllers.js) before your app script. So just load in the app.js last