Error: $injector:modulerr Module Error seems there is an injection error in my directive but I don't understand whats wrong in my code

javascript2016

It seems there is an injection error in my directive but I don't understand whats wrong in my code and other posts in that issue didn't really help me figure that out. Anyone has an idea? Happy about any suggestions! Thanks!!!

my index.html

<!DOCTYPE html>
<html>
    <head>
        <title>Flash Cards</title>
        <link rel="stylesheet" type="text/css" href="css/reset.css" />
        <link rel="stylesheet" type="text/css" href="css/style.css" />
        <script src="angular.min.js"></script>
        <script src="js/app.js"></script>
        <script src="js/navbar/navbar.js"></script>
        <script src="js/home/home.js"></script>
        <script src="js/about/about.js"></script>
    </head>
    <body ng-app="flashCards" >
        <navbar></navbar>
   hello
    </body>
</html>

my directive:

app.directive('navbar', function ($rootScope, $state) {
  return {
    restrict: 'E',
    scope: {},
    templateUrl: 'js/navbar/navbar.html',
    link: function (scope) {

        scope.items = [
            { label: 'Home', state: 'home' },
            { label: 'Unsere Praxis', state: 'about' },
            // { label: 'Leistungen', state: 'docs' },
            //  { label: 'Sprechstunden', state: 'sprechstunden' },
            //   { label: 'Kontakt', state: 'kontakt' },
            //    { label: 'Termin buchen', state: 'book' }

        ];

    }

  };
});

navbar html

<nav class="navbar navbar-static-top">
   <div class="container">
     <div class="navbar-header">
        <fullstack-logo></fullstack-logo>
    </div>
    <ul class="nav navbar-nav">
        <li ng-repeat="item in items">
            <a ui-sref-active="active" ui-sref="{{ item.state }}">{{ item.label }}</a>
        </li>

    </ul>
    <button ng-show="!user" ui-sref="login" class="btn login-button">Login</button>
    <div ng-show="user" class="welcome">
        <span>Welcome, {{ user.email }}!</span>
        <a >Logout</a>
    </div>
  </div>
</nav>
mrzli

I guess it is hard to say for sure without trying it myself, but here is a possibility:

What is this $state you use in:

app.directive('navbar', function ($rootScope, $state) {

Is this the $state of ui router? If so maybe you are missing a link to angular-ui-router.js, something like:

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/1.0.0-beta.2/angular-ui-router.js"></script>

Also don't forget to make sure you added a dependency to your application module:

angular.module('app', ['ui.router']);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

I don't understand the error message int not iterable in my code

From Dev

Error: $injector:modulerr Module Error

From Dev

$injector:modulerr error with my angular app

From Dev

Angular directive test - Error: [$injector:modulerr] Failed to instantiate module?

From Dev

Angular directive test - Error: [$injector:modulerr] Failed to instantiate module?

From Dev

My Selenium Webdriver script is returning an error that I don't understand

From Dev

My Selenium Webdriver script is returning an error that I don't understand

From Dev

angular Error: $injector:modulerr Module Error

From Dev

Angular route Error: $injector:modulerr Module Error

From Dev

Error: $injector:modulerr Module Error angularjs

From Dev

Angular JS Error: $injector:modulerr Module Error

From Dev

Whats wrong with my ButtonGroup? Compiler error

From Dev

AngularJS dependency injection $injector:modulerr error

From Dev

It's my first time using android studio and getting error? Don't know what seems to be wrong with it?

From Dev

Need help getting my Angular Module to load: Uncaught Error: [$injector:modulerr]

From Dev

AdventureWorks activation error in SQL Server, I don't know if it is my pathway is wrong or my database is wrong

From Dev

Sabre HotelRateDescription soap call failing, don't understand error message or whats wrong?

From Dev

AngularJS Error: $injector:modulerr Module Error when trying to use OpenLayers directive

From Dev

Error: [$injector:modulerr] Failed to instantiate module app

From Dev

Error: [$injector:modulerr] Failed to instantiate module app

From Dev

Uncaught Error: [$injector:modulerr] Failed to instantiate module

From Dev

$injector:modulerr Module Error in angularjs 1

From Dev

Error: $injector:modulerr Module Error Failed to instantiate module printStation due to: Error: [$injector:modulerr

From Dev

Uncaught Error: [$injector:modulerr]

From Dev

Error: [$injector:modulerr]

From Dev

Error: [$injector:modulerr]

From Dev

uncaught Error: [$injector:modulerr]

From Dev

Uncaught Error: [$injector:modulerr]

From Dev

Angularjs : [$injector:modulerr] error

Related Related

  1. 1

    I don't understand the error message int not iterable in my code

  2. 2

    Error: $injector:modulerr Module Error

  3. 3

    $injector:modulerr error with my angular app

  4. 4

    Angular directive test - Error: [$injector:modulerr] Failed to instantiate module?

  5. 5

    Angular directive test - Error: [$injector:modulerr] Failed to instantiate module?

  6. 6

    My Selenium Webdriver script is returning an error that I don't understand

  7. 7

    My Selenium Webdriver script is returning an error that I don't understand

  8. 8

    angular Error: $injector:modulerr Module Error

  9. 9

    Angular route Error: $injector:modulerr Module Error

  10. 10

    Error: $injector:modulerr Module Error angularjs

  11. 11

    Angular JS Error: $injector:modulerr Module Error

  12. 12

    Whats wrong with my ButtonGroup? Compiler error

  13. 13

    AngularJS dependency injection $injector:modulerr error

  14. 14

    It's my first time using android studio and getting error? Don't know what seems to be wrong with it?

  15. 15

    Need help getting my Angular Module to load: Uncaught Error: [$injector:modulerr]

  16. 16

    AdventureWorks activation error in SQL Server, I don't know if it is my pathway is wrong or my database is wrong

  17. 17

    Sabre HotelRateDescription soap call failing, don't understand error message or whats wrong?

  18. 18

    AngularJS Error: $injector:modulerr Module Error when trying to use OpenLayers directive

  19. 19

    Error: [$injector:modulerr] Failed to instantiate module app

  20. 20

    Error: [$injector:modulerr] Failed to instantiate module app

  21. 21

    Uncaught Error: [$injector:modulerr] Failed to instantiate module

  22. 22

    $injector:modulerr Module Error in angularjs 1

  23. 23

    Error: $injector:modulerr Module Error Failed to instantiate module printStation due to: Error: [$injector:modulerr

  24. 24

    Uncaught Error: [$injector:modulerr]

  25. 25

    Error: [$injector:modulerr]

  26. 26

    Error: [$injector:modulerr]

  27. 27

    uncaught Error: [$injector:modulerr]

  28. 28

    Uncaught Error: [$injector:modulerr]

  29. 29

    Angularjs : [$injector:modulerr] error

HotTag

Archive