When using angular 1.2 instead of 1.07 the following piece of code is not valid anymore, why?
'use strict'; var app = angular.module('myapp', []); app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { $locationProvider.html5Mode(true); $routeProvider. when('/', { templateUrl: 'part.html', controller: 'MyCtrl' }). otherwise({ redirectTo: '/' }); } ]);
the issue is in the injector configuration part (app.config):
Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.0rc1/$injector/modulerr?p0=muninn&p1=Error%…eapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.0rc1%2Fangular.min.js%3A31%3A252)
If I remember correctly this issue started with angular 1.1.6.
The problem was caused by missing inclusion of ngRoute module. Since version 1.1.6 it's a separate part:
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular-route.min.js"></script> var app = angular.module('myapp', ['ngRoute']);
my error disappeared by adding this '()' at the end
(function(){ var home = angular.module('home',[]); home.controller('QuestionsController',function(){ console.log("controller initialized"); this.addPoll = function(){ console.log("inside function"); }; }); })();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With