Occassional Unknown provider: $ templateRequestProvider <- $ templateRequest <- $ route <- ngViewDirective error
I am working on an angular app and it works fine on machine # 1, and when I cloned the repo on <2> 2> and executed mine npm install
, bower install
and grunt bower-install
, things are not loading.
After you navigated to the site, many pointed out that this is a common side effect of the ng route not being included.
When the page loads, a "view source" is displayed showing that ng-route was enabled successfully:
<!-- build:js(app) scripts/vendor.js --> <!-- bower:js --> <script src="bower_components/jquery/dist/jquery.js"></script> <script src="bower_components/angular/angular.js"></script> <script src="bower_components/angular-resource/angular-resource.js"></script> <script src="bower_components/angular-cookies/angular-cookies.js"></script> <script src="bower_components/angular-sanitize/angular-sanitize.js"></script> <script src="bower_components/angular-route/angular-route.js"></script> <script src="bower_components/Chart.js/Chart.js"></script> <script src="bower_components/angular-chart.js/dist/angular-chart.js"></script> <script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script> <script src="bower_components/d3/d3.js"></script> <script src="bower_components/codemirror/lib/codemirror.js"></script> <script src="bower_components/angular-ui-codemirror/ui-codemirror.js"></script> <!-- endbower --> <!-- endbuild -->
And my app.js file is definitely asking for ngRoute
:
angular.module('myApp', [ 'ngCookies', 'ngResource', 'ngSanitize', 'ngRoute', 'chart.js', 'ui.bootstrap', 'ui.codemirror' ])
and my routes are defined like this:
$routeProvider.when('/dashboard', { templateUrl: 'partials/dashboard', controller: 'DashboardCtrl' })
Then I verified that these dependencies were actually loaded:
^ - which seems to be "yes", they loaded. I clicked them to make sure the answers are actually the correct javascript content. Each contains the correct content.
In terms of resource version angular-route.js
- work site uses route v1.3.14
- Broken site uses route v1.3.15
The error message in the console doesn't seem to be of any use in terms of determining why this is happening. How do I debug this?
source share
Have you checked if you have the following ingredients correctly in your bar?
<script src="bower_components/angular/angular.js"></script> <script src="bower_components/angular-resource/angular-resource.js"></script> <script src="bower_components/angular-cookies/angular-cookies.js"></script> <script src="bower_components/angular-sanitize/angular-sanitize.js"></script> <script src="bower_components/angular-route/angular-route.js"></script>
Or if you have any HTML problem on the web regarding the package download?
Your error looks like this: the ngRoute module is not loaded and this issue occurs when trying to use the provider.
source share