Hi in my angular application, I am using routeProvider for routing partials, and in one page i have a set of links i am using ng-href for providing link. and I have a ng-click event for the link. but when I click on the link the page goes to the otherWise section of routeProvider and loads the page I have defined there.
see the code
HTML
<li ng-repeat="item in supplyItem">
<a class="span" ng-click="showDetails()" ng-href="#{{item.header}}">
{{item.header}}
</a>
</li>
App.js
var myApp = angular.module("myApp",[
'ngRoute',
'appController'
]);
myApp.config(['$routeProvider',function($routeProvider){
$routeProvider.
when('/home',{
templateUrl : 'partials/home_page.aspx',
controller:'HomePageController',
}).
when('/supplies',{
templateUrl : 'partials/supplies.aspx',
controller:'SupplyController',
}).
otherwise({
redirectTo: '/home'
});
}]);
controller.js
appController.controller('SupplyController', ['$scope', function ($scope) {
$scope.firstITem = "Acrylics";
$scope.showDetails = function() {
alert("clicked");
}
$scope.supplyItem = [
{
"header": "Acrylics",
"Acrylics": [
"Custom Tray Material",
"Reline Materials",
"Reline Materials-Hard",
"Reline Materials-Soft",
"Repair Acrylics",
"Resin & Pattern Materials",
"Temporary Crown and Bridge Material",
"Tissue Conditioner",
]
}
];
} ]);
what is the error ? how can I solve this
$scope.showDetails = ...