My goal is to incorporate the functionality demonstrated in this example: https://material.angularjs.org/1.1.1/demo/navBar
To achieve this, I have created the following index.html
:
<!DOCTYPE html> <html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<div ng-controller="AppCtrl" ng-cloak="" class="navBardemoBasicUsage" ng-app="MyApp">
<md-content class="md-padding">
<md-nav-bar md-selected-nav-item="currentNavItem" nav-bar-aria-label="navigation links">
<md-nav-item md-nav-click="goto('page1')" name="page1">Page One</md-nav-item>
<md-nav-item md-nav-click="goto('page2')" name="page2">Page Two</md-nav-item>
<md-nav-item md-nav-click="goto('page3')" name="page3">Page Three</md-nav-item>
</md-nav-bar>
<div class="ext-content">
External content for `<span>{{currentNavItem}}</span>`
</div>
</md-content></div>
<script src="vendor/angular/angular.min.js"></script>
<script src="http://ngmaterial.assets.s3.amazonaws.com/svg-assets-cache.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular-animate.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular-aria.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular-messages.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular-route.min.js"></script>
<script src="app.js"></script>
</body>
</html>
Alongside that, I also prepared the app.js
:
(function() {
'use strict';
angular.module('MyApp',['ngMaterial', 'ngMessages', 'material.svgAssetsCache'])
.controller('AppCtrl', AppCtrl);
function AppCtrl($scope) {
$scope.currentNavItem = 'page1';
}
})();
However, during implementation of the above, I encountered an exception:
Failed to instantiate module MyApp due to:
Error: [$injector:modulerr] http://errors.angularjs.org/1.5.8/$injector/modulerr?p0=n...)
at http://localhost:8000/vendor/angular/angular.min.js:6:412
at http://localhost:8000/vendor/angular/angular.min.js:40:222
at q (http://localhost:8000/vendor/angular/angular.min.js:7:355)
at g (http://localhost:8000/vendor/angular/angular.min.js:39:319)
at http://localhost:8000/vendor/angular/angular.min.js:39:488
at q (http://localhost:8000/vendor/angular/angular.min.js:7:355)
at g (http://localhost:8000/vendor/angular/angular.min.js:39:319)
at cb (http://localhost:8000/vendor/angular/angular.min.js:43:336)
at c (http://localhost:8000/vendor/angular/angular.min.js:20:390)
at Bc (http://localhost:8000/vendor/angular/angular.min.js:21:179
I am unsure of what went wrong here, any advice would be highly appreciated.