ui-sref未显示生成的网址

时间:2018-08-22 10:02:53

标签: angularjs angular-ui-router

我已经使用动态URL来重定向angular js中的页面。面包屑和重定向链接不适用于特定页面。这是我的app.js代码

require('angular');
require('angular-ui-router');
require('angular-aria');
require('angular-animate');
require('angular-material');
require('./components/login/login.js');
require('./components/dashboard/dashboard.js');
require('./components/subadmin/subadmin.js');
require('./components/subadmin/subadmin-edit.js');
require('./components/subadmin/subadmin-view.js');
require('./shared/service/serviceFactory.js');
require('./shared/service/superadminService.js');
require('./shared/header/header.js');
var app = angular.module('superAdminApp', ['ui.router','ngMaterial','superAdminApp.login','superAdminApp.dashboard','superAdminApp.header','superAdminApp.subadmin','superAdminApp.subadminEdit','superAdminApp.subadminView']);

app.config(['$locationProvider', '$stateProvider', '$urlRouterProvider', function($locationProvider, $stateProvider, $urlRouterProvider) {

    $locationProvider.hashPrefix('');

    $urlRouterProvider.otherwise("login");

    $stateProvider
    .state('login', {
        url: "/login",
        views : {
            "container@" : {
                templateUrl:"app/components/login/login.html"
            }
        }
    })
    .state('root',{
        url: '',
        abstract: true,
        views: {
          'header': {
            templateUrl: 'app/shared/header/header.html'
          },
          'footer':{
            templateUrl: 'app/shared/footer/footer.html'
          }
        }
    })
    .state('root.dashboard', {
        url: "/dashboard",
        views : {
            "container@" : {
                templateUrl:"app/components/dashboard/dashboard.html"
            }
        }
    })
    .state('root.subadmin', {
        url: "/subadmin",
        views : {
            "container@" : {
                templateUrl:"app/components/subadmin/subadmin.html"
            }
        }
    })
    .state('root.subadminview', {
        url: "/subadmin-view/:id",
        views : {
            "container@" : {
                templateUrl:"app/components/subadmin/subadmin-view.html"
            }
        }
    })
    .state('root.subadminedit', {
        url: "/subadmin-edit/:id",
        views : {
            "container@" : {
                templateUrl:"app/components/subadmin/subadmin-edit.html"
            }
        }
    });
}]).run(['$rootScope', '$state',
    function ($rootScope, $state) {
        $rootScope.$state = $state;
    }
]).constant('BASE_CONFIG', {
    useMock:true
});

下面的链接不起作用

<a ui-sref="root.subadmin" href>
    <div class="circle center-block"><br/>
        <img src="assets/img/users.png">
    </div>
    <div class="dashboard"><br/>
        <p>SUB ADMIN<br/>MANAGEMENT</p>
        <p class="big">{{showCount}}</p>
        <span>Sub Admin's</span><br/><br/>
    </div>
</a>

我不知道我犯了什么错误。它适用于一个URL,而不适用于另一个URL。请帮助我

0 个答案:

没有答案