I am using Apache server to host angular application. This is index.html:
<html> <head> <script src="/lib/angular/angular.js"> </head> <script> myapp = angular.module('myapp', []); myapp.controller('indexCtrl', function($scope){ $scope.words = ['It','is','what','it','is'] }); </script> <body ng-app="myapp"> <div ng-controller="indexCtrl"> <div ng-repeat="word in words"> {{word}} </div> </div> </body> </html>
When I hit the html from the browser, it shows a blank page with this error:
Unprepared error: [$ injector: modulerr] Unable to create myapp module because of: Error: [$ injector: nomod] 'myapp' module is not available!
You either mistakenly wrote the name of the module, or forgot to load it. If registering a module ensures that you specify the dependencies as the second argument.
What could be wrong?
angularjs angularjs-ng-repeat
moaglee
source share