DeborahK / AngularF2BWebAPI

Files for the "Angular Front to Back With Web API" Pluralsight course by Deborah Kurata.
MIT License
124 stars 228 forks source link

Error: [ng:areq] Argument 'ProductListCtrl' is not a function, got undefined #10

Closed kdevunoori closed 5 years ago

kdevunoori commented 8 years ago

Can you please help me in resolving this issue? Please find the files attached for the code.

Index.html

<!DOCTYPE html>

Acme Product Management ``` ``` ```
``` #

app.js

var app = angular.module("productManagement", ["common.services"]);

common.services.js

angular .module("common.services", ["ngResource"]) .constant("appSettings", { serverPath: "http://localhost:52396/"

});

productListCtrl.js

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

function ProductListCtrl(productResource) {
    var vm = this;
    productResource.query(function (data) {
        vm.products = data;
    });
}

productResource.js

angular .module("common.services") .factory("productResource", ["$resource", "appSettings", productResource])

function productResource($resource, appSettings) { return $resource(appSettings.serverPath + "/api/products/:id");

}

human3820917 commented 8 years ago

There is a typo in the original productListCtrl.js. The typo is ProductListCtrl ...

angular
    .module("productManagement")
    .controller("ProductListCtrl",
                 ProductListCtrl);

ProductListCtrl should be productListCtrl

DeborahK commented 5 years ago

I assume from the above that this issue was resolved. I'm closing it. Thanks!