I had this question a while ago, and it took me several hours to figure it out.
In some cases, you need to make sure that you enter "productResource" and "$scope" and follow a specific order. Let me demonstrate:
angular.module("productManagement").controller("ProductListController", ["$scope", "productResource", ProductListController]); function ProductListController($scope, productResource) {
The above code will always work, but if you switch positions as shown below, in some cases (as I mentioned above) this will not work.
angular.module("productManagement").controller("ProductListController", ["productResource","$scope", ProductListController]); function ProductListController($scope, productResource) {
I have never encountered this problem to make sure that the dependencies are entered in the correct order until today. If after this your code still does not work, the problem is probably elsewhere.
Hope this helps.
source share