Skip to content

feat(router): implement link DSL #5557

Description

@btford

Following #2845...

RouterLink should accept something like: [router-link]="link: /User".

Below is a (non-exhaustive) list of DSL and the corresponding angular expression

Link Transformed to
User ['User']
/User ['/User']
./User ['./User']
../../User ['../../User']
./User(id: value) ['./User', {id: value} ]
./User(id: value, name: 'Bob') ['./User', {id: value, name: 'Bob'} ]
./User(id) ['./User', {id: id} ]
./User(id)/Post ['./User', {id: id}, 'Post' ]
./User(id: value)/Post(title: 'blog') ['./User', {id: value}, 'Post', {title: 'blog'} ]
./User[Modal] ['./User', [ 'Modal' ] ]
./User(id: value)[Modal] ['./User', {id: value} , [ 'Modal' ] ]
./User[Modal1][Modal2] ['./User', [ 'Modal1' ], [ 'Modal2' ] ]
./User[Modal(param: value)] ['./User', [ 'Modal', {param: value} ] ]
./User[Modal[Modal2]] ['./User', [ 'Modal', ['Modal2'] ] ]

All of these are incorrect uses of the DSL, and should throw:

./User[Modal](id: value) – the (...) always comes before [...]
//User – two slashes in a row are not allowed
.../Foo
/Foo/../Bar.. is only allowed at the beginning of the link

I'll update this with more if needed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureLabel used to distinguish feature request from other issues

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions