问题描述:

I have a left nav in my one of the view of the application whiich is build using ng-repeat and ng-switch. every link's action associate to a directive in the right hand side. some time, the particular directive will include other directive when user click on the dropdown items from the current directive and page gets extended long and long , so if user want to go to the original state then he can click on the nav item from the left nav to refresh the page to the initial state of the directive. But whenever user clicks on the left nav second time when the left nav already selected, it is not get triggered.I want this get tirggered to bring my initial page of the RHS.

My highlevel code as follows

about.html

<div class="leftNav">

<ul class="nav myNav">

<li class="presentation" ng-repeat="link in links" ng-class="{link-active:currentLink=link.value==param}">

<a ng-href="#/home/{{link.value}}" ng-click="fetchLink(param)">{{link.title}}</a>

</li>

</ul>

</div>

<div ng-switch="fetchLink()">

<div ng-switch-when="About Us">

<div about-us></div>

</div>

<div ng-switch-when="Board Directors">

<div board-directors></div>

</div>

<div ng-switch-when="Our Impacts">

<div our-impacts></div>

</div>

</div>

aboutController.js

 $scope.links = [{ title="About Us", value="about"},

{ title="Board Directors",value="board"},

{ title="Our Impacts", value="impact"} ];

var myParam =$root.current.params;

$scope.param = myParam.sec;

//sec has been configured in the route and get

// the values from user's input

$scope.fetchLink() = function() {

var retVal='';

var retVals = $.grep($scope.links, function(item,ind){

return item.value=$scope.param

});

if(retVals.length>0){

retVal = retVals[0].title;

}

return retVal;

};

};

On the router code of app.js

$routeProvider

.when('/about/:sec', {

templateUrl : 'app/view/about.html',

controller: 'aboutController.js'

});

}

When i click the second time, nothing get triggered and fetchLink() method is not triggered.

相关阅读:
Top