Angular JS Uncaught Error: [$injector:modulerr]

后端 未结 15 1826
攒了一身酷
攒了一身酷 2020-12-09 01:08

I am having a problem with Angular JS receiving an error : Uncaught Error: [$injector:modulerr]. My JS-file looks

angular.module(\'MyApp\', [\'ngRoute\']);
         


        
15条回答
  •  既然无缘
    2020-12-09 02:06

    Make sure you're function is wrapped in a closure, complete with the extra () at the end:

    (function(){                                                                     
    
        var app = angular.module('myApp', []);                                     
    
    
    })();  
    

提交回复
热议问题