Home  >  Article  >  Web Front-end  >  Detailed explanation of the steps to implement route jump using JS

Detailed explanation of the steps to implement route jump using JS

php中世界最好的语言
php中世界最好的语言Original
2018-04-18 10:05:121690browse

This time I will bring you a detailed explanation of the JS implementation routing jump steps, what are the precautions for JS implementation of route jump, the following is a practical case, let’s take a look .

JS is used very frequently for many people, and js also has a very powerful production effect. This article will introduce to you the sample code for using js to achieve routing jump effect. I hope it will be helpful to you in js application. If you are interested, come and learn about it.

There are complex routing jumps 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>

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the PHP Chinese website!

Recommended reading:

Detailed explanation of shiro authorization implementation

##How to operate the mongodb database in Node.js

The above is the detailed content of Detailed explanation of the steps to implement route jump using JS. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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