Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught ReferenceError: app is not defined and Error: [$injector:modulerr] Failed to instantiate module app due to: #147

Open
sangeetha1241 opened this issue Jul 20, 2017 · 0 comments

Comments

@sangeetha1241
Copy link

Error:

Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:nomod] Module 'app' 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.

karma.confi.js:

in files I added all reference files file to load module(app).

Spec.js

describe("create request test", function () {
var RequestService;
var inputRequest;
var RequestProvider;
var messageService;
var appConstants
var controller;
var scope;
var q;
var location;
var window;
var state;
var modal;
beforeEach(module("app"));

beforeEach(inject(function ($rootScope, $controller, $injector, $q,$location,$window,$state,$modal) {
		RequestService = $injector.get("RequestService");
  inputRequest = $injector.get("inputRequest");
  RequestProvider = $injector.get("RequestProvider");
  messageService = $injector.get("messageService");
  appConstants = $injector.get("appConstants");

		scope = $rootScope.$new;
		controller = $controller("createRequestController", {
				$scope : scope,
      $q:q,
      $location :location,
      $window :window,
      $state :state,
      $modal : modal
			});
	}));

it("controller should exist", function () {
	expect(controller).not.toBe(undefined);
});

it("controller call commentIndex method ", function () {
	
	expect(scope.commentIndex).toBeNull();
});

});

controller.js:

app.controller("createRequestController", [ '$scope', "$rootScope", "$q","$location", "$window", "$state","RequestService","inputRequest","RequestProvider","messageService","$modal","appConstants",
function($scope, $rootScope, $q, $location, $window, $state,RequestService,inputRequest,RequestProvider,messageService,$modal,appConstants) {
$scope.appConstants = appConstants;
$scope.commentIndex='';

app.js:

var app = MyApp = angular.module("MyApp", [ "ui.router", "ui.bootstrap",
"ngRoute" ,"agGrid","ui.select","ngTextTruncate","infinite-scroll","ngDragDrop","ngSanitize"]);

@sangeetha1241 sangeetha1241 changed the title Uncaught ReferenceError: app is not defined Uncaught ReferenceError: app is not defined and Error: [$injector:modulerr] Failed to instantiate module app due to: Jul 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant