Tom
Tom

Reputation: 8681

Error: $injector:modulerr Module Error in angular1

I have implemented ui-router in my angular 1 application and also configured the route state. When I try to access the page, I get the error as mentioned in the title of this post. Please find my code below. Could somebody tell me where have I gone wrong.

app.js

    (function () {
    "use strict";
    var app = angular.module("productManagement", ["common.services","ui.router"]);

}());

config.js

(function () {

    "use strict";
    var app = angular.module("productManagement");


    app.config(["stateProvider",
            function ($stateProvider) { 
                $stateProvider
                .state("productList", {
                    url: "/product",
                    templateUrl: "app/product/productListView.html",
                    controller: "ProductListController as vm"
                });

    }]);

}

());

ProductListController

(function () {

    "use strict";

    angular
        .module("productManagement")
        .controller("ProductListController", ["productResource", ProductListController]);

    function ProductListController (productResource)
    {
        var vm = this;

        productResource.getProducts()
         .then(function (response) {

             vm.products = response.data;
         }, function (error) {
             vm.status = 'Unable to load product data: ' + error.message;
         });



        vm.showImage = false;

        vm.toggleImage = function () {
            vm.showImage = !vm.showImage;
        };

    }

}());

Upvotes: 0

Views: 111

Answers (1)

rrd
rrd

Reputation: 5957

The one thing in his config that needs changing:

.config(["stateProvider",

to

.config(['$stateProvider',

Upvotes: 1

Related Questions