下面的连接中有复杂的路由跳转!
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>title</title> <script src="angular1.4.6.min.js"></script> <script src="angular-route.js"></script> </head> <body ng-app="myapp" > <a href="#/" rel="external nofollow" >china</a><br/> <a href="#/1" rel="external nofollow" >china1</a><br/> <a href="#/2" rel="external nofollow" >china2</a><br/> <a href="#/3" rel="external nofollow" >china3</a><br/> <p ng-view> 11111 </p> <script> var app = angular.module("myapp", ["ngroute"]); app.config(function ( $routeprovider) { $routeprovider .when("/", {template: "<h1>123</h1>"}) .when("/1", {template: "<h1>111</h1>"}) .when("/2", {template: "<h1>222</h1>"}) .when("/3", {template: "<h1>333</h1>"}); }); </script> </body> </html>
以上所述是小编给大家介绍的js路由跳转的简单实现代码,希望对大家有所帮助!!
相关推荐:
javascript实现多重继承实例详解
javascript体验异步更好的解决办法分享
javascript匹配js中注释的正则表达式代码
以上就是js路由跳转的简单实现代码的详细内容。
