角度代码无法正常工作

时间:2017-03-30 07:36:46

标签: angularjs angular-ui-router



<div ui-view></div>
&#13;
&#13;
&#13; 我在我的index.html文件中写了这个div标签,因此可以显示详细信息。

&#13;
&#13;
<div class="col-md-9 col-sm-11 cTwo">
                <div class="navbar navbar-default">
                    <div class="container">
                        <!-- Brand and toggle get grouped for better mobile display -->
                        <div class="navbar-header">
                            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse" aria-expanded="true">
                                <span class="sr-only">Toggle navigation</span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                            </button>
                        </div>

                        <!-- Collect the nav links, forms, and other content for toggling -->
                        <div class="collapse navbar-collapse">
                            <ul class="nav navbar-nav">
                                <li><a ui-sref="venueList">Venue Details</a></li>
                                <li><a ui-sref="batchList">Batch Details</a></li>
                                <li><a ui-sref="studentDetails">Student Details</a></li>
                                <li><a ui-sref="trainerDetails">Trainer Details</a></li>
                            </ul>
                        </div>


                    </div>
                </div>
<!--                <div ui-view></div>-->

            </div>
        </div>
&#13;
&#13;
&#13;

这是我的dashboard.html文件,它是在index.html页面中调用ui-view时出现的,但我想在点击链接时显示不同的html页面,如此代码所示。 Html详细信息应该出现在我使用ui-view评论div标签的位置。

&#13;
&#13;
angular.module("activeCubs", ["signUp","login","dashboard","venueGet", "editVenue", "myListApp", "studentApp", "batchApp", "trainerDet", "ui.router", "xeditable", "ngDialog"])
       .config(function ($stateProvider, $urlRouterProvider) {
        $urlRouterProvider.otherwise("/login");
        $stateProvider

            .state("signUp",{
            url:"/register",
            templateUrl: "forms/signup.html",
            controller:"myCtrl"
            })
            .state("login",{
                   url:"/login",
                   templateUrl:"forms/login.html",
                   controller:"loginCtrl"
                   })
            .state("dashboard", {
            url:"/dashboard/:token",
            templateUrl:"dashboard.html",
            controller:"dashboard"
        })

            .state("venueList", {
                url: "/venueList",
                templateUrl: "venue/venueDetailsListView.html",
                controller: "venueGetCtrl"
            })
            .state("venueDetails", {
                url: "/venueDetails",
                templateUrl: "venue/venueDetails.html",
                controller: "venueDetailCtrl"
            })
            .state("editVenueDetails", {
                url: "/editVenueDetails",
                templateUrl: "venue/venueDetailsEdit.html",
                controller: "editCtrl"
            })
            .state("batchList", {
                url: "/batchList",
                templateUrl: "batch/batchlist.html",
                controller: "myListCtrl"
            })
            .state("batchDetails", {
                url: "/batchDetails",
                templateUrl: "batch/batchdetails.html",
                controller: "batchCtrl"
            })
            .state("studentDetails", {
                url: "/studentDetails",
                templateUrl: "student/stdtwo.html",
                controller: ""
            })
            .state("studentData", {
                url: "/studentData",
                templateUrl: "student/stdone.html",
                controller: ""
            })
            .state("trainerDetails", {
                url: "/trainerDetails",
                templateUrl: "trainer/trainerDetails.html",
                controller: "trainerCtrl"
            })
            .state("index", {
                url: "/index",
                templateUrl: "index.html",
                controller: ""
            })
            .state("editTrainer", {
                url: "/editTrainer",
                templateUrl: "trainer/traineredit.html",
                controller: "trainerCtrl"
            })
    });
&#13;
&#13;
&#13;

这是我的app.js文件。

1 个答案:

答案 0 :(得分:-2)

我认为你有一个额外的div没有打开..请检查你有5个开放div但是6个关闭div.Hope这个帮助。