0

I can't find the mistake in my application. The error stack that i receive is this one:

Error: [ng:areq] Argument 'RepoController' is not a function, got undefined

Here is the code of app.js

(function() {

var app = angular.module('gitHubViewer',["ngRoute"]);

app.config(function($routeProvider) {

    $routeProvider.when("/main", {
        templateUrl: "main.html",
        controller: "MainController"
    })
    .when("/user/:username", {
        templateUrl: "user.html",
        controller: "UserController"
    })
    .when("/repo/:usermane/:reponame", {
        templateUrl: "repo.html",
        controller: "RepoController"
    })
    .otherwise({
        redirectTo:"/main"
    });

});



}());

here is the code of the controller

(function() {


var module = angular.module('gitHubViewer');

var RepoController = function($scope, github, $routeParams) {

    var onRepoDetailsComplete = function(data) {

        $scope.issues = data;
        github.getRepoCotributors($score.username, $scope.reponame).then(onRepoCotributorsComplete,onError);

    };

    var onRepoCotributorsComplete = function(data) {


        $scope.repoContribuors = data;

    };

    var onError = function(reason) {

        $scope.error = reason;

    }

        $scope.username = $routeParams.username;
        $scope.reponame = $routeParams.reponame;
        github.getRepoDetails($score.username, $scope.reponame).then(onRepoDetailsComplete,onError);

};

module.controller('RepoController',["$scope","github","$routeParams",RepoController]);

}());

Can you please have a look becuase I really can't find teh mistake that I made.

Regards

Fabio

10
  • 1
    can you provide a plnkr? Commented Nov 29, 2014 at 16:12
  • Make sure you have imported the RepoController file. The error usually occurs when angular couldn't find the corresponding controller globally. Commented Nov 29, 2014 at 16:25
  • @23tux thank you for your comment. Here it is: plnkr.co/edit/ae047qwVVaHI8GJfJfzP Commented Nov 29, 2014 at 16:26
  • Did you fix it? The plnkr doesn't appear to throw an error? Commented Nov 29, 2014 at 16:34
  • I haven't fix it unfortunately. You can see the error when you click on one of the repo. Commented Nov 29, 2014 at 16:37

1 Answer 1

1

Where does "$score.username" come from?

 github.getRepoDetails($score.username, $scope.reponame)

I think that you are missing a dependency for the $score or you have just misspelled $scope.

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.