Angular ui sref无法在一页中使用

时间:2018-07-04 12:46:23

标签: angularjs oclazyload ui-sref

我正在使用oclazyload配置我的角度应用程序,也使用ui路由器。

这是我的有角度的应用程序

var Irn = angular.module("Irn", [
    "ui.router",
    "oc.lazyLoad"
]);

我的配置

Irn.config(["$stateProvider", "$urlRouterProvider", "$controllerProvider", "$compileProvider", "$filterProvider", "$provide", "$ocLazyLoadProvider",
    function($stateProvider ,  $urlRouterProvider ,  $controllerProvider ,  $compileProvider ,  $filterProvider ,  $provide ,  $ocLazyLoadProvider) {

    Irn.controller = $controllerProvider.register;
    Irn.directive = $compileProvider.register;
    Irn.filter = $filterProvider.register;
    Irn.factory = $provide.factory;
    Irn.service = $provide.service;
    Irn.constant = $provide.constant;


    $urlRouterProvider.otherwise("/IrnIndex");


.state("IrnIndex",
            {
                url: "/IrnIndex",
                templateUrl: "/Application/Modual/IrnClan/View/IrnIndex.html",
                controller: "IrnIndexController as self",
                resolve: {
                    loadCtrl: [
                        "$ocLazyLoad", function ($ocLazyLoad) {
                            return $ocLazyLoad.load({
                                name: "Irn",
                                files: [
                                    "/Application/Modual/IrnClan/Controller/IrnIndexController.js"
                                ]
                            });
                        }
                    ]
                }
            })


             .state("IrnMember",
            {
                url: "/IrnMember",
                templateUrl: "/Application/Modual/IrnClan/View/IrnMember.html",
                controller: "IrnMemberController as self",
                resolve: {
                    loadCtrl: [
                        "$ocLazyLoad", function ($ocLazyLoad) {
                            return $ocLazyLoad.load({
                                name: "Irn",
                                files: [
                                    "/Application/Modual/IrnClan/Controller/IrnMemberController.js"
                                ]
                            });
                        }
                    ]
                }
            })

及其我的观点

   <a ui-sref="IrnIndex">
        Home
    </a>

    <a ui-sref="IrnMember">
        Member
    </a>

    <div class="right-content" ui-view></div>

现在我有问题。

当我单击以转到“成员”视图时,它不起作用,并加载了成员内容。

仅当在新标签页中单击打开链接或输入

时,此选项才有效

<a data-ui-sref="IrnIndex" target="blank" href="#">

0 个答案:

没有答案