Skip to content
This repository has been archived by the owner on Feb 25, 2021. It is now read-only.

Add @page directive #244

Merged
merged 1 commit into from
Mar 13, 2018
Merged

Add @page directive #244

merged 1 commit into from
Mar 13, 2018

Conversation

rynowak
Copy link
Member

@rynowak rynowak commented Mar 12, 2018

Adds the @page directive and support for specifying routes in components
at compile time.

For now the route is required and must begin with a leading /.

Copy link
Member

@SteveSandersonMS SteveSandersonMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

If we could also allow multiple @page per component that would be perfect.

builder =>
{
builder.AddStringToken(Resources.PageDirective_RouteToken_Name, Resources.PageDirective_RouteToken_Description);
builder.Usage = DirectiveUsage.FileScopedSinglyOccurring;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we have FileScopedMultipleOccurring? There will be cases where people want to define more than one URL pattern that maps to the same component.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure


// Only process the first directive occurrence. The parser will have already flagged multiple
// usages as errors.
var pageDirective = (DirectiveIntermediateNode)directives[0].Node;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As previous comment, would be good if we allowed multiple.


namespace Microsoft.AspNetCore.Blazor.Components
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here

Adds the @page directive and support for specifying routes in components
at compile time.

For now the route is required and must begin with a leading /.
@rynowak rynowak merged commit de487b9 into feature/0.1.0 Mar 13, 2018
@rynowak rynowak deleted the rynowak/page-directive branch March 13, 2018 03:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants