JS路由跳轉功能有很多方法可以實現,本文主要和大家分享一個簡單的js路由跳轉功能,非常不錯,需要的朋友參考下吧。希望能幫助大家。
下面的連線中有複雜的路由跳到
<!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路由跳轉的簡單方法的詳細內容。更多資訊請關注PHP中文網其他相關文章!