I've exhausted all the solutions I found on stackoverflow without success. Apologies if this is a duplicate question.
My goal is to reset the content of my Bootstrap table with a button click using the function $route.reload()
. However, when I include it in the click function and add the necessary dependency, I receive the error
Unknown provider: $routeProvider <- $route <- AppController
. I'm unsure why this error is occurring.
Here is the code snippet:
<button ng-model="NewDataSet" ng-click="ReloadTable();">Reset</button><br/>
Angularjs:
var app = angular.module('myApp', ['CopyToClipboard','ngRoute'], function() {});
app.controller('AppController2', function($scope,$http,$location,$anchorScroll,$copyToClipboard,$route){
$scope.ReloadTable = function(){
console.log("JRJRJ");
//$window.location.reload();
$route.reload();
}
})
var app = angular.module('myApp', ['CopyToClipboard','ngRoute'], function() {});
app.controller('AppController2', function($scope,$route){
$scope.ReloadTable = function(){
$route.reload();
}
})
I have tried various solutions suggested by others including:
Including the cdn in my HTML file
Adding the dependency like this:
app.controller('AppController2',['$route', function($scope,$route){ $scope.ReloadTable = function(){ $route.reload(); } }]);
Referencing this video. The solution seems similar but works for him and not for me.
As I've run out of ideas, I decided to seek suggestions from the community here.
Additional Information:
These are the Angularjs CDNs that I am using in my HTML file:
<!-- Angularjs CDN Starts -->
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="https://cdn.rawgit.com/zenorocha/clipboard.js/master/dist/clipboard.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular-route.min.js"></script>
<!-- Angularjs CDN Ends -->