dimanche 29 mai 2016

Factory is not a function in my controller

I am trying to write a factory and use it in one of my controllers, but it gives me an error:

TypeError: wordsToTrain is not a function

I made my controller and factory very simple but still don`t get why is this happening:

angular.module('bananaApp')
  .controller('TrainingCtrl', [ '$scope', 'wordsToTrain', function ($scope, wordsToTrain) {
    wordsToTrain();
  }]);

angular.module('bananaApp')
  .factory('wordsToTrain', function () {
    return  3;
  });




Aucun commentaire:

Enregistrer un commentaire