Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce file-based @analogjs/router library #101

Merged
merged 24 commits into from
Oct 19, 2022
Merged

Conversation

brandonroberts
Copy link
Member

@brandonroberts brandonroberts commented Oct 11, 2022

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

This PR:

  • Adds a new @analogjs/router library that adds file-based routing on top of the Angular router.
  • Routes are defined in the src/app/routes folder
  • Example app has been updated to use the router

Sample route file

src/app/routes/about.ts

import { Component } from '@angular/core';
import { defineRouteMeta, injectRouter, injectActivatedRoute } from '@analogjs/router';

export const routeMeta = defineRouteMeta({
  title: 'About Analog',
  canActivate: [() => true],
  providers: [AboutService]
});

@Component({
  selector: 'app-about',
  standalone: true,
  template: `
    <h2>About Analog</h2>

    Analog is a meta-framework on top of Angular.
  `
})
export default class AboutPageComponent {
  route = injectActivatedRoute();
  router = injectRouter();
}
  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Which package are you modifying?

  • vite-angular-plugin
  • astro-angular
  • create-analog

What is the current behavior?

Issue Number: #1

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

packages/router/src/lib/routes.ts Outdated Show resolved Hide resolved
packages/router/src/lib/routes.ts Outdated Show resolved Hide resolved
@brandonroberts brandonroberts merged commit 480e8e1 into main Oct 19, 2022
@brandonroberts brandonroberts deleted the router branch October 19, 2022 12:42
Villanuevand pushed a commit to Villanuevand/analog that referenced this pull request Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants