Home > Web Front-end > JS Tutorial > A simple way to redirect JS routes

A simple way to redirect JS routes

小云云
Release: 2018-02-07 11:48:52
Original
2057 people have browsed it

There are many ways to implement the JS route jump function. This article mainly shares with you a simple js route jump function. It is very good. Friends who need it can refer to it. Hope it helps everyone.

There is a complex route jump in the following connection

<!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>
Copy after login

Related recommendations:

Vue determines whether the user is logged in when the route jumps

H5 routing jump implementation method

An example tutorial summarizing Vue routing jump issues

The above is the detailed content of A simple way to redirect JS routes. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template