我试图在我的角应用程序包括以下引导可折叠面板。然而,当我点击“展开”,角似乎看到href =“#collapSEOne”,然后重定向到主页,而不是折叠面板。我的路由看起来像这样,我认为否则({redirectTo:’/ home’});是导致问题。有什么建议么?
angular.module('App') .config(['$routeProvider',function($routeProvider) { $routeProvider. when('/users',{templateUrl: 'partials/users/user-list.html',controller: 'UserCtrl'}). when('/users/new',{templateUrl: 'partials/users/user-new.html',controller: 'UserNewCtrl'}). when('/users/:userid',{templateUrl: 'partials/users/user-detail.html',controller: 'UserDetailCtrl'}). otherwise({redirectTo: '/home'}); }]);
面板 –
<div class="panel-group" id="accordion"> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#accordion" href="#collapSEOne"> Expand </a> </h4> </div> <div id="collapSEOne" class="panel-collapse collapse in"> <div class="panel-body"> ... </div> </div> </div> </div>
正如一个类似的问题
Here中提到,只需更改您的href的data-target属性
原文链接:https://www.f2er.com/angularjs/145998.html<div class="panel-group" id="accordion"> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a href="javascript:;" data-toggle="collapse" data-parent="#accordion" data-target="#collapSEOne"> Expand </a> </h4> </div> <div id="collapSEOne" class="panel-collapse collapse in"> <div class="panel-body"> ... </div> </div> </div> </div>