Comments (8)
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.
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.
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.
I can pick this up soon.
from angular-cli.
@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.
@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.
I've a PR proposal for route generation in #139. It does somewhat more than adding a single route.
from angular-cli.
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)
- environment variables no longer added to main.js with application build HOT 7
- hmr not working HOT 1
- dev-server executor expects certain options, but error message does not give away how to solve HOT 3
- Angular.json budgets not finding the created bundles
- dev-server does not run dependencies HOT 2
- Option to update budgets when building app or export list of initial chunk files HOT 1
- "npm install" always hangs on https://registry.npmjs.org/run-applescript HOT 5
- Angular SSR Migration Bug HOT 8
- serve: serving static files using vite differs from the previous builder HOT 2
- vitePlugins options at serveWithVite HOT 6
- Dynamic template compilation breaks with aot and webpack builder HOT 1
- Angular CLI Cache with Serve ignores custom builder HOT 1
- Angular CLI @angular-devkit/build-angular:application not working with dynamic imports HOT 1
- Localization and baseHref HOT 1
- @angular/build:library builder? HOT 1
- Package subpath error with plugin for Custom esbuild builder HOT 1
- rspack support would be revolutionary HOT 1
- Reduce angular uses of file watcher by leveraging folder watcher (ex: ng serve) HOT 1
- Add support for esbuild chunkNames option HOT 3
- "Uncaught TypeError" switching Angular Builder to "@angular-devkit/build-angular:application" HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-cli.