javascript - Uncaught Error: [$injector:modulerr] Failed to instantiate module scheduleApp due to: -
html
<!doctype html> <html ng-app="scheduleapp"> <head> <title>angularjs schedule</title> <link rel="stylesheet" type="text/css" href="css/bootstrap.css"> <link rel="stylesheet" type="text/css" href="css/style.css"> <script src="js/angular.js"></script> <script src="js/angularfire.min.js"></script> <script src="js/firebase.js"></script> </head> <body> <div class="container" ng-controller="maincontroller"> <div class="page-header text-center"> <h1>schedule city</h1> </div> <div class="row times"> <div class="col-xs-4 text-center"> <h2>{{day.name}}</h2> <div class="time-slot" ng-repeat="slot in day.slots"> </div>
javascript
angular.module('scheduleapp',['firebase']) .controller('maincontroller', function($scope){ var ref = new firebase("https://torrid-inferno-884.firebaseio.com/days"); var fb = $firebase(ref); var syncobject = fb.$asobject(); syncobject.$bindto($scope,'days'); $scope.reset = function() { fb.$set({ monday: { name: 'monday', slots: { 0900: { time: '9:00am', booked: false }, 0110: { time: '11:00am', booked: false } } }, tuesday: { name: 'tuesday', slots: { 0900: { time: '9:00am', booked: false }, 0110: { time: '11:00am', booked: false } } } }); }; });
error: [$injector:nomod] module 'scheduleapp' not available! either misspelled module name or forgot load it. if registering module ensure specify dependencies second argument.
basically messed file loading sequence. firebasejs should there before angularfire.min.js
uses firebase.js code internally.
<script src="js/angular.js"></script> <script src="js/firebase.js"></script> <script src="js/angularfire.min.js"></script> <script src="js/otherscripts.js"></script>
update
inject $firebase dependency in controller function
.controller('maincontroller', function($scope, $firebase){
Comments
Post a Comment