V
V
Vasyl Pylypiv2015-08-16 20:26:16
Angular
Vasyl Pylypiv, 2015-08-16 20:26:16

Why doesn't Angular see the module?

There is a piece of code.

var app = angular.module('todoApp', ['ui.router', 'ngResource', 'ui.bootstrap']);

app.config(['$stateProvider', '$urlRouterProvider', 
  function($stateProvider, $urlRouterProvider) {
    
    $urlRouterProvider.otherwise("/");

     $stateProvider
        .state('home', {
          url: "/",
          templateUrl: '/templates/index.html',
        })
        .state('signup', {
          url: "/signup",
          templateUrl: '',
        })
}]);

module.exports = app;

When launched in a browser, it throws an error: ReferenceError: module is not defined.
Why doesn't he see him?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-08-16
Protko @Fesor

if you are using ng-app then all scripts must be loaded before the document.ready event. That is, it is necessary to shove the section into the head in the right order.
If you want to load scripts asynchronously, then angular.bootstrap will help you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question