Giter Club home page Giter Club logo

Comments (8)

vikeen avatar vikeen commented on April 27, 2024

How do you see the routes getting created? Where would they live?

I think if there was just one route file this would be fairly easy, but if you go from a component or feature approach the route would maybe live in the related sub folder. The latter would make a route generator hard.

I do agree that the starting should have some route examples though.

from angular-cli.

dpurp avatar dpurp commented on April 27, 2024

hmm.. I was expecting a single, top-level routes file.

I can see how projects may want to register their routes in a sub-folder, but it seems like that would be more of an advanced user case. For the casual user wanting to start a new Angular2 project, it would be nice if routing worked "right-out-of-the-box."

from angular-cli.

IgorMinar avatar IgorMinar commented on April 27, 2024

My current thinking is that routes should really be routable components. These unlike regular components get generated in as a nested directory structure that maps to the route directory structure.

from angular-cli.

filipesilva avatar filipesilva commented on April 27, 2024

I can pick this up soon.

from angular-cli.

samjulien avatar samjulien commented on April 27, 2024

@filipesilva I am happy to help out with this too. I'm still learning ng2 but this project is great - the ember-cli is super useful.

from angular-cli.

filipesilva avatar filipesilva commented on April 27, 2024

@samjulien thanks! I think it's going to be easy enough, but adding routes will need these two PRs in as well #66 #100

@IgorMinar Routable components seems the way to go, like described here in angular.io. Maybe even doing the routable component + list component + detail component + service all at once.

Thus, running

ng generate route heroes

Would generate the following folder structure

...
|-- app
|   |-- ...
|-- heroes
|   |-- heroes.component.ts
|   |-- heroes-detail.component.ts
|   |-- heroes-list.component.ts
|   |-- heroes.service.ts
|-- app.ts
...

And would add the child route definition to the router in app.ts:

...
  {
    path: '/heroes/...',
    name: 'Heroes',
    component: HeroesComponent
  },
...

from angular-cli.

filipesilva avatar filipesilva commented on April 27, 2024

I've a PR proposal for route generation in #139. It does somewhat more than adding a single route.

from angular-cli.

angular-automatic-lock-bot avatar angular-automatic-lock-bot commented on April 27, 2024

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

from angular-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.