Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular Error: $injector:modulerr Module Error

I am trying to run one of Angular Materials examples but for the life of me I can't figure out why I'm getting this error.

The error I am getting is Error: $injector:modulerr Module Error

This is the error report I got: link

Any ideas what the issue could be? I practically copy-pasted this from their examples website.

Here is the code:

angular.module('MyApp',['ngMaterial', 'ngMessages', 'material.svgAssetsCache'])

.controller('AppCtrl', function($scope) {

});
.buttondemoBasicUsage section {
  background: #f7f7f7;
  border-radius: 3px;
  text-align: center;
  margin: 1em;
  position: relative !important;
  padding-bottom: 10px; }

.buttondemoBasicUsage md-content {
  margin-right: 7px; }

.buttondemoBasicUsage section .md-button {
  margin-top: 16px;
  margin-bottom: 16px; }

.buttondemoBasicUsage .label {
  position: absolute;
  bottom: 5px;
  left: 7px;
  font-size: 14px;
  opacity: 0.54; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-route.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.js"></script>

<div ng-controller="AppCtrl" ng-cloak="" class="buttondemoBasicUsage" ng-app="MyApp">
  <md-content>

    <section layout="row" layout-sm="column" layout-align="center center" layout-wrap="">
      <md-button class="md-icon-button md-primary" aria-label="Settings">
        <md-icon md-font-icon="icon-home"></md-icon>
      </md-button>
      <md-button class="md-icon-button md-accent" aria-label="Favorite">
        <md-icon md-font-icon="icon-home"></md-icon>
      </md-button>
      <md-button class="md-icon-button" aria-label="More">
        <md-icon md-font-icon="icon-home"></md-icon>
      </md-button>
      <md-button href="http://google.com" title="Launch Google.com in new window" target="_blank" ng-disabled="true" aria-label="Google.com" class="md-icon-button launch">
        <md-icon md-font-icon="icon-home"></md-icon>
      </md-button>
      <div class="label">Icon Button</div>
    </section>
  </md-content>
</div>

<!--
Copyright 2016 Google Inc. All Rights Reserved. 
Use of this source code is governed by an MIT-style license that can be in foundin the LICENSE file at http://material.angularjs.org/license.
-->
like image 562
Katie Avatar asked Jan 28 '16 14:01

Katie


2 Answers

Did you reference the .js file related to your angular app? I can just see the external javascript dependencies but nothing related to your app - controller. Take care about the order you're importing it

like image 95
CleanCoder Avatar answered Oct 21 '22 23:10

CleanCoder


Most probably you are missing svg icons

<script src="http://ngmaterial.assets.s3.amazonaws.com/svg-assets-cache.js"></script>
like image 45
alexeiTruhin Avatar answered Oct 21 '22 23:10

alexeiTruhin