Skip to content

in class decorator@IonicPage, default value of segment in IonicPageMetadata , is not the value of 'name'  #13557

@GuoLunHao

Description

@GuoLunHao

Ionic version: (check one with "x")
(For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[ x ] 3.x
[ ] 4.x

I'm submitting a ... (check one with "x")
[ x ] bug report
[ ] feature request

Current behavior:
After upgrade to ionic-angular 3.9.2 , default value of segment property doesn't use the value of name, which does in the ionic-angular 3.5.3 version

Expected behavior:
If segment property isn't provided, the segment will use the value of name.

Steps to reproduce:

  1. define two component with the same class name in two different folder, such as "PC/MainPage.ts" "Mobile/MainPage.ts"
@IonicPage({name:"PC_MainPage"})
@Component({
    selector: "PC_MainPage",
    templateUrl: "MainPage.html",
})
export class MainPage  {
...
}
@IonicPage({name:"Mobile_MainPage"})
@Component({
    selector: "Mobile_MainPage",
    templateUrl: "MainPage.html",
})
export class MainPage  {
...
}

it works well with ionic-angular 3.5.3. After I upgrade the project to ionic-angular 3.9.2 with angular 5.0.3, ionic serve shows the errors as below:

[14:09:54]  watch started ...
[14:09:54]  build dev started ...
[14:09:55]  clean started ...
[14:09:55]  clean finished in 4 ms
[14:09:55]  copy started ...
[14:09:55]  deeplinks started ...
Error: There are multiple entries in the deeplink config with the segment of MainPage

It seems that both of segment value of two components are 'MainPage' cause the problem.

After I modify the code with explicit segment value as below, no more errors

@IonicPage({name:"PC_MainPage", segment:"PC_MainPage"})
@Component({
    selector: "PC_MainPage",
    templateUrl: "MainPage.html",
})
export class MainPage  {
...
}
@IonicPage({name:"Mobile_MainPage", segment:"Mobile_MainPage"})
@Component({
    selector: "Mobile_MainPage",
    templateUrl: "MainPage.html",
})
export class MainPage  {
...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions