0

Would anyone know why my service is not being passed into controller. I receive an error: Argument 'fn' is not a function.

references within my main web page:

<script src="~/js/app-categories.js"></script>
<script src="~/js/addingNewTaskService.js"></script>
<script src="~/js/addNewTaskController.js"></script>

app-categories.js:

(function () {

    "use strict";

    angular.module("app-categories", ["simpleControls", "ngRoute", "ngAnimate", "addNewTask"])
        .config(function ($routeProvider) {

            ...

        });

})();

addingNewTaskService.js:

(function () {

    "use strict";

    alert("inside service");

    angular.module("app-categories")
    .service('addingNewTaskService'), function () {

    };
})();

addNewTaskController.js:

(function () {

    "use strict";

    angular.module("app-categories")
    .controller("addNewTaskController", addNewTaskController);

    function addNewTaskController($scope, $http, addingNewTaskService) {

        ...
    }

})();

1 Answer 1

2

You have a syntax error here:

.service('addingNewTaskService'), function () {

};

That should be:

.service('addingNewTaskService', function() {

});
Sign up to request clarification or add additional context in comments.

1 Comment

You are not the first and will not be the last to make a silly mistake.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.