Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular ionic-v4使用url导航应用程序_Angular_Ionic Framework_Ionic4 - Fatal编程技术网

Angular ionic-v4使用url导航应用程序

Angular ionic-v4使用url导航应用程序,angular,ionic-framework,ionic4,Angular,Ionic Framework,Ionic4,我有一个登录页面和三个页面,我想通过url导航。也就是说,我想在浏览器的地址栏上写下: localhost:8100/mySite/page1 然后转到第1页 localhost:8100/mySite/page3 然后转到第3页 我的问题是,每次我在地址栏中写入地址时,Ionic-v4都会重新加载整个应用程序,并将我带回登录页面 const routes:routes=[ {路径:'',重定向到:'login',路径匹配:'full'}, {path:'p1',loadChildren:'

我有一个登录页面和三个页面,我想通过url导航。也就是说,我想在浏览器的地址栏上写下:

localhost:8100/mySite/page1
然后转到第1页

localhost:8100/mySite/page3
然后转到第3页

我的问题是,每次我在地址栏中写入地址时,Ionic-v4都会重新加载整个应用程序,并将我带回登录页面

const routes:routes=[
{路径:'',重定向到:'login',路径匹配:'full'},
{path:'p1',loadChildren:'./pages/p1/p1.module#P1Module',可以激活:[AuthGuard]},
{path:'p2',loadChildren:'./pages/p2/p2.module#P2Module',可以激活:[AuthGuard]},

{path:'p3',loadChildren:'./pages/p3/p3.module#P3Module',canActivate:[AuthGuard]}]

您的
/mySite/pageX
路由似乎与路由定义不匹配,因此默认为登录路径

试着定义你的路线,比如

const routes:routes=[
{路径:'',重定向到:'login',路径匹配:'full'},
{path:'mySite/page1',loadChildren:'./pages/p1/p1.module#P1Module',可以激活:[AuthGuard]},
{path:'mySite/page2',loadChildren:'./pages/p2/p2.module#P2Module',可以激活:[AuthGuard]},
{path:'mySite/page3',loadChildren:'./pages/p3/p3.module#P3Module',可以激活:[AuthGuard]}
]
此外,如果未正确完成,AuthGuard可能会将您发送到登录路径