0

This is my script.js code:

var app = angular.module('starter', [])

app.provider('RouteHelpers', function () {

    this.basepath = function (uri) {
        return 'app/views/' + uri;
    };

    this.$get = function () {
    };

}); 

app.config(function (RouteHelpers) {
    console.log('Never gets here');
});

And this is index.html:

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title></title>

    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">


<script src="angular.min.js"></script>


    <script src="script.js"></script>
  </head>

  <body ng-app='starter'>


  </body>
</html>

And I'm getting this error in my browser: https://tinyurl.com/nbareaa Does someone have an idea what is wrong in this code?

1 Answer 1

1

You have created a provider, which means if you try and inject it into your config function you must append Provider to the end of the providers name, for example:

app.config(function(RouteHelpersProvider){

});

You are getting the error because it cannot find the given injector. You can read more here under provider recipe.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.