本篇文章主要讲述的是angluar中如何运用路由来跳转页面

来源:互联网 发布:淘宝钻石展位展现位置 编辑:程序博客网 时间:2024/06/03 16:36
<script src="../../script/angular.min.js"></script><script src="../../script/angular-route.js"></script><script>    var myapp=angular.module("myapp",["ngRoute"]);    myapp.config(['$routeProvider', function($routeProvider){        $routeProvider            .when('/shouye',{                templateUrl:'pages/shouye.html',                controller: 'shouyeController'            })            .when('/news',{                templateUrl:"pages/news.html",                controller: 'newsController'            })            .when('/youxi',{                templateUrl:"pages/youxi.html",                controller: 'youxiController'            })            .when('/chaxun',{                templateUrl:"pages/chaxun.html",                controller: 'chaxunController'            })            .when('/richeng',{                templateUrl:"pages/richeng.html",                controller: 'richengController'            })            .otherwise({redirectTo:'shouye'});    }]);    //这里需要注意的事有些东西必须有
     <div class="left">        <ul>              <li><a href="#shouye">首页</a></li>              <li><a href="#news">新闻</a></li>              <li><a href="#chaxun">查询</a></li>              <li><a href="#richeng">日程</a></li>              <li><a href="#youxi">游戏</a></li>       </ul>     </div>//这里注意需要用ng-view来告诉服务器我们路由的东西展示在哪里 <div class="right" ng-view=""></div>



阅读全文
0 0
原创粉丝点击