Kash Kash - 4 months ago 12
AngularJS Question

Angular is failing to load my app module

Facing some problem in loading the application module, please help, if need anymore code please let me know. Thanks in advance.

index.html

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/
1.5.7/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/
1.5.7/angular-route.js"></script>
<script type="text/javascript" src="/app/app.js"></script>
<script src="/app/trading/controllers/members-controller.js"></script>
<script src="/app/components/paginate/paginate-filter.js"></script>
<script src="/app/trading/services/trading-service.js"></script>


app.js

angular.module("nkApp", [
'ngRoute',
'ngResource',
'nkApp.members',
'nkApp.paginate-filter',
'nkApp.tradingService'
]).
config(['$routeProvider', function($routeProvider){
$routeProvider.
when("/", {templateUrl: "/app/trading/members/members-view.html",
controller: "membersController"}).
when("/trading-api/members/:id", {templateUrl:
"app/trading/members/member.html", controller: "membersController"}).
when("/trading-api/members/:username", {templateUrl:
"app/trading/members/member.html", controller: "membersController"}).
otherwise({redirectTo: "/"});
}]);


Console Error after removing ngResource

http://errors.angularjs.org/1.5.7/$injector/modulerr?p0=nkApp&p1=%5B%24injector%3Amodulerr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.5.7%2F%24injector%2Fmodulerr%3Fp0%3DnkApp.members%26p1%3D%255B%2524injector%253Amodulerr%255D%2520http%253A%252F%252Ferrors.angularjs.org%252F1.5.7%252F%2524injector%252Fmodulerr%253Fp0%253Dui.bootstrap%2526p1%253D%25255B%252524injector%25253Anomod%25255D%252520http%25253A%25252F%25252Ferrors.angularjs.org%25252F1.5.7%25252F%252524injector%25252Fnomod%25253Fp0%25253Dui.bootstrap%25250AO%25252F%25253C%252540https%25253A%25252F%25252Fajax.googleapis.com%25252Fajax%25252Flibs%25252Fangularjs%25252F1.5.7%25252Fangular.min.js%25253A6%25253A412%25250Ale%25252F%25253C%25252F%25253C%25252F%25253C%252540https%25253A%25252F%25252Fajax.googleapis.com%25252Fajax%25252Flibs%25252Fangularjs%25252F1.5.7%25252Fangular.min.js%25253A25%25253A72%25250Ab%252540https%25253A%25252F%25252Fajax.googleapis.com%25252Fajax%25252Flibs%25252Fangularjs%25252F1.5.7%25252Fangular.min.js%25253A24%25253A115%25250Ale%25252F%25253C%25252F%25253C%252540https%25253A%25252F%25252Fajax.googleapis.com%25252Fajax%25252Flibs%25252Fangularjs%25252F1.5.7%25252Fangular.min.js%25253A24%25253A358%25250Ag%25252F%25253C%252540https%25253A%25252F%25252Fajax.googleapis.com%25252Fajax%25252Flibs%25252Fangularjs%25252F1.5.7%25252Fangular.min.js%25253A39%25253A374%25250Ar%252540https%25253A%25252F%25252Fajax.googleapis.com%25252Fajax%25252Flibs%25252Fangularjs%25252F1.5.7%25252Fangular.min.js%25253A7%25253A353%25250Ag%252540https%25253A%25252F%25252Fajax.googleapis.com%25252Fajax%25252Flibs%25252Fangularjs%25252F1.5.7%25252Fangular.min.js%25253A39%25253A222%25250Ag%25252F%25253C%252540https%25253A%25252F%25252Fajax.googleapis.com%25252Fajax%25252Flibs%25252Fangularjs%25252F1.5.7%25252Fangular.min.js%25253A39%25253A391%25250Ar%252540https%25253A%25252F%25252Fajax.googleapis.com%25252Fajax%25252Flibs%25252Fangularjs%25252F1.5.7%25252Fangular.min.js%25253A7%25253A353%25250Ag%252540https%25253A%25252F%25252Fajax.googleapis.com%25252Fajax%25252Flibs%25252Fangularjs%25252F1.5.7%25252Fangular.min.js%25253A39%25253A222%25250Ag%25252F%25253C%252540https%25253A%25252F%25252Fajax.googleapis.com%25252Fajax%25252Flibs%25252Fangularjs%25252F1.5.7%25252Fangular.min.js%25253A39%25253A391%25250Ar%252540https%25253A%25252F%25252Fajax.googleapis.com%25252Fajax%25252Flibs%25252Fangularjs%25252F1.5.7%25252Fangular.min.js%25253A7%25253A353%25250Ag%252540https%25253A%25252F%25252Fajax.googleapis.com%25252Fajax%25252Flibs%25252Fangularjs%25252F1.5.7%25252Fangular.min.js%25253A39%25253A222%25250Adb%252540https%25253A%25252F%25252Fajax.googleapis.com%25252Fajax%25252Flibs%25252Fangularjs%25252F1.5.7%25252Fangular.min.js%25253A43%25253A246%25250ABc%25252Fc%252540https%25253A%25252F%25252Fajax.googleapis.com%25252Fajax%25252Flibs%25252Fangularjs%25252F1.5.7%25252Fangular.min.js%25253A20%25253A359%25250ABc%252540https%25253A%25252F%25252Fajax.googleapis.com%25252Fajax%25252Flibs%25252Fangularjs%25252F1.5.7%25252F

Answer

You're trying to inject ngResource without the script.

Just add it in your HTML:

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.7/angular-resource.js"></script>