Search code examples
angularjsangularjs-ng-routechecklist-model

checklist-model module does not work when using ng-route


I was trying to use [checklist-model] (https://github.com/vitalets/checklist-model) module in my app but I caught an error that I have figured out it was because of using (ngRoute) module in the same app.

var mainMod = angular.module('MainApp', ['ngRoute'],['checklist-model']);

mainMod.config(['$routeProvider',function($routeProvider) {

        $routeProvider
            .when("/patient-list", {
                templateUrl: "patient-list.html",
                            controller: "dbCtrl"

            })
            .when("/patientRecord", {
                templateUrl: "patientRecord.html",
                controller: "MainCtrl2"
            })
            .otherwise({
                templateUrl: "patient-list.html",
                            controller: "dbCtrl"

            })

    }

]);

The error:

angular.min.js:6Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.24/$injector/modulerr?p0=MainApp&p1=Error%3…%20gc%20(http%3A%2F%2Flocalhost%2Ftest%2Ffiles%2Fangular.min.js%3A36%3A309)

If there is any solution for this I will be happy to know.

Thanks for your efforts


Solution

  • The second parameter is supposed to be an array of all of your dependencies. Try angular.module('MainApp', ['ngRoute', 'checklist-module']); instead.

    Also, using the unminified version for your development work will produce more useful error messages.