如何将表单php页面重定向到不同的Angularjs模板

时间:2016-09-07 13:00:49

标签: angularjs angular-ui-router ngroute

我在php中创建了登录页面。(例如url:test.com/login)

和注册页。(示例网址:test.com/signup)

当用户登录时,然后在Angular应用程序中进行页面重定向。(例如url:test.com/admin#/)

但是

案例1:

当用户登录然后重定向到示例url:test.com/admin/#Dashboard

案例2:

用户在注册后登录然后重定向到示例url:test.com/admin/#accountverify

我如何处理上述情况?

Angular route Code:

app.config(['$routeProvider', function ($routeProvider) {
    $routeProvider
            .when("/", {templateUrl: "angular/cpModule/templates/accountverify.html", controller: "cpController"})
            .when("/Dashboard", {templateUrl: "angular/templates/dashboard.html", controller: "AdminDashController"})
            .when("/accountverify", {templateUrl: "angular/cpModule/templates/accountverify.html", controller: "cpController"})
            .when("/agreement", {templateUrl: "angular/cpModule/templates/agreement.html", controller: "cpController"})
            .when("/termnservices", {templateUrl: "angular/cpModule/templates/termnservices.html", controller: "cpController"})
            .when("/mobileverify", {templateUrl: "angular/cpModule/templates/mobileverify.html", controller: "cpController"})
            .otherwise("/accountverify", {templateUrl: "angular/cpModule/templates/accountverify.html", controller: "cpController"});
}]);

我感谢所有回复。

1 个答案:

答案 0 :(得分:1)

使用州参数,

    case 'FILTER_ALL_USERS': return allUsers.filter(user => user.userNameLast.toLowerCase().indexOf(action.filter.toLowerCase()) >= 0);

根据您可以重定向视图的值

在param1中传递一些值

在控制器中,

angular.module('myApp', [ … ])
  .config(function ($routeProvider) {
    $routeProvider
      .when('/login/:param1', {
        templateUrl: 'main.html',
        controller: 'MainController'
      })
      .otherwise({
        redirectTo: '/'
      });
  });