I am trying to change the href value on click of it.
This is what I have tried.
HTML:
<a href="#Page1">Demo</a>
JS:
angular.config(function ($routeProvider) {
$routeProvider
.when('/Page1', {
templateUrl: 'main.html'
controller: 'FirstController'
})
.when('/Page2', {
templateUrl: 'sub.html'
controller: 'FirstController'
})
.otherwise('main.html');
How do I change the path of the anchor tag everytime when I clicked on it.
Can anyone please help me out.
ng-hrefto change the value of anhrefattribute. This will automatically change the href when your controller value changes.