Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
单击时,高亮显示的活动选项卡不会切换。使用Angularjs ui路由器ui引导选项卡_Angularjs_Angular Ui Router - Fatal编程技术网

单击时,高亮显示的活动选项卡不会切换。使用Angularjs ui路由器ui引导选项卡

单击时,高亮显示的活动选项卡不会切换。使用Angularjs ui路由器ui引导选项卡,angularjs,angular-ui-router,Angularjs,Angular Ui Router,我正在使用Angularjs ui路由器ui引导选项卡。 它在我的网站上工作,但在我的网站上不工作。单击时,活动选项卡不会突出显示。但正确的内容会加载 var app = angular.module('Plunker', ['ui.router', 'ui.bootstrap']) app.config(function($stateProvider, $urlRouterProvider) { $stateProvider .state('tab1', {

我正在使用Angularjs ui路由器ui引导选项卡。 它在我的网站上工作,但在我的网站上不工作。单击时,活动选项卡不会突出显示。但正确的内容会加载

var app = angular.module('Plunker', ['ui.router', 'ui.bootstrap'])

app.config(function($stateProvider, $urlRouterProvider) {
  $stateProvider

      .state('tab1', {
            url: '/tabpage1',
            templateUrl: 'tab1.html',
            controller:'tabsController' 
      })
      .state('tab2', {
            url: '/tabpage2',
            templateUrl: 'tab2.html',
            controller:'tabsController' 
      })

      .state('tab3', {
            url: '/tabpage3',
            templateUrl: 'tab3.html',
            controller:'tabsController' 
      })

    $urlRouterProvider.otherwise('/');
});

app.controller('tabsController',['$scope','$state',function($scope, $state){
    $scope.tabs = [
    { title: 'Announcements', route:'tab1', active:false},
    { title: 'Course Info', route:'tab2', active:true},
    { title: "Timetable", route: "tab3", active: false },
];


}]);
有人能提出建议吗?
谢谢。

您的网站代码是什么样子的?除了tab1/tab2/tab3.html的路径指向yii2文件夹中的一个文件外,我在plunker中的代码完全相同。无法理解为什么只有“课程信息”选项卡突出显示为默认值,但单击时无法更改。我的代码正确吗?angularjs中的新手。你更改了状态和模板了吗?没有。我遵循了与plunker相同的设置,作为第一个测试的示例。当我更改路线时,选项卡更改活动突出显示:“tab1”为路线:“.tab1”,其他两个选项卡相同。同样对于“.state('tab1',{…”到“.state('tab1',{…”),但这样做不会加载内容。