angular.js - angular 项目开发中页面跳转的问题
某草草
某草草 2017-05-15 17:12:15
0
2
745

在真正的项目开发中 有很多个页面 ,那各个页面是不是都是通过一个index页面 , 在index页面里放一个<p ui-view></p> 然后配置很多个路由来跳转,传参的呢?

某草草
某草草

reply all(2)
PHPzhong

What you are talking about should be an example of using angularjs to implement a single-page application. Generally, we will put public references and common navigation in the index and then write ng-view in the area where we want to implement the jump module, and then use the app. js configure jump routes and corresponding controllers. Put controllers with similar functions and businesses together like this

洪涛
  1. Yes, SPA single-page application jumps by configuring routes. In HTML, <ui-view></ui-view> is used to define the content jump part. The essence of ui-router is to embed set, so this ui-view can be multi-layered
    2. Parameter configuration, first explain the parameter name in the routing configuration part

        .state("order.detail", {
            url: "/Detail/?:order_id",
            templateUrl: "/detail.html",
            title: "Detail",
            controller: "detailCtrl",
            params: {'order_id': null, 'order_status': null}
          });

In the example, there are two parameters, order_id and order_status. You can splice the parameters into the URL. :order_id is spliced. :order_id就是拼接的
在跳转的过程中传递参数ui-sref="order.detail({ order_id: order.id })"Pass the parameter ui-sref="order. detail({ order_id: order.id })"

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!