generator-angular-fullstack icon indicating copy to clipboard operation
generator-angular-fullstack copied to clipboard

[FIXED] Using a factory in a specific controller isn't working

Open Jotakuun opened this issue 11 years ago • 0 comments

Hi!,

I'm trying to get variables from a factory I've created with the "yo angular-stack:factory" injector and use it within other specific controllers in my project. So I want to use the factory "DataService" in the controller "ProductsCtrl" which is inside my "products" route but can't get it working. I don't know how can I call this factory to use it in my controllers because I don't even know what the file "products.controller.spec" is doing, so I don't know if I should call the DataService factory within this file.

This is the way in calling the DataService factory in the file "product.controller", but like I said it isn't working.

.controller('ProductCtrl', function ($scope, $http, $routeParams, DataService) {
        code ...

EDIT: Ok,I'm sorry. I fixed by my own, the problem wasn't about this route. It was a problem of the variable I was trying to use from my factory.

Jotakuun avatar Nov 26 '15 21:11 Jotakuun