angular ui router - How to redirect form php page to different Angularjs template -
i have create login page in php.(example url: test.com/login)
and signup page.(example url: test.com/signup)
when user login page redirect in angular application.(example url: test.com/admin#/)
but
case 1:
when user login redirect example url: test.com/admin/#dashboard
case 2:
when user login after signup redirect example url: test.com/admin/#accountverify
how can above cases?
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"}); }]);
i appreciate response.
use state param,
angular.module('myapp', [ … ]) .config(function ($routeprovider) { $routeprovider .when('/login/:param1', { templateurl: 'main.html', controller: 'maincontroller' }) .otherwise({ redirectto: '/' }); });
pass value in param1 based on value can redirect view
in controller,
if($stateparams.param1 == 'after_signup'){ /* accountverify page */ }else{ /* login page */ }
Comments
Post a Comment