How can i make a dynamic ajax load page function?
i don't want to declare all the 'routes' like this
angular.module('myApp', ['ngRoute'])
.config(function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.when('/day/:id', {
templateUrl: 'views/day.html',
controller: 'DayCtrl'
})
.otherwise({
redirectTo: '/'
});
})
i want to be able to load files with 1 function that does something like this;
<a href="myLinkToFile" ng-click="loadPage()">
loadPage function(){
var url = "get the HREF of the element that is clicked"
load the file and put it in a div
and prevent default click of the <a>
}