1. 程式人生 > >Uncaught ReferenceError: app is not defined

Uncaught ReferenceError: app is not defined

Uncaught ReferenceError: app is not defined

angular.min.js:80 Error: [$injector:unpr] http://errors.angularjs.org/1.2.9/$injector/unpr?p0=uploadServiceProvider%20%3C-%20uploadService
    at angular.min.js:2
    at angular.min.js:28
    at Object.c [as get] (angular.min.js:26)
    at angular.min.js:28
    at c (angular.min.js:26)
    at d (angular.min.js:26)
    at Object.instantiate (angular.min.js:27)
    at angular.min.js:57
    at angular.min.js:45
    at q (angular.min.js:3)

程式碼正確,但就是頁面無法正常顯示, 原因很可能就是引入的js檔案順序有問題:

    <script type="text/javascript" src="../js/service/uploadService.js">  </script>
    <script type="text/javascript" src="../js/base_pagination.js">  </script>
    <script type="text/javascript" src="../js/service/contentCategoryService.js">  </script>

將基層js檔案放在最上方即可:

 
    <script type="text/javascript" src="../js/base_pagination.js">  </script>
    <script type="text/javascript" src="../js/service/contentCategoryService.js">  </script> 
    <script type="text/javascript" src="../js/service/uploadService.js">  </script>