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)
- `loader` option in the `application` builder does not work for *.css files. HOT 4
- Esbuild error while deploying Angular 16.2.12 +node 16.15.1 using Jenkins, but the ng build works fine in local. The same project deployed successfully with Angular 15 and node 14. HOT 1
- Add supprt for OSC 8 for filepath in output HOT 1
- SSR v17 app won't let docker expose application port HOT 1
- Angular SSR Issue: When attempting to execute npm run start, it appears that Express is not running to enable hot reload. HOT 3
- CSS source maps are not created with application builder (Angular 17) HOT 1
- Asset referenced with CSS variables not found using application-builder HOT 6
- Tests using `web-test-runner` time out waiting for the browser to start
- Could not resolve "zone.js/node" HOT 6
- Support webpack-dev-server v5 HOT 1
- Routing not working in application under projects folder HOT 1
- Replace usages of '@nguniversal/' packages with '@angular/ssr'. × Migration failed HOT 1
- headers for dev-server not working anymore after upgrade from angular 16 to 17 HOT 4
- @angular-devkit/build-angular depends on vulnerable version of tar HOT 1
- globalThis.ng gets replaced HOT 5
- Angular compilation initialization failed. [plugin angular-compiler] HOT 2
- Deprecated type attribute in `index.html`: `<style type="text/css">`
- Angular never searches for zone.js in the correct path HOT 6
- Amount of spaces after ng generate HOT 3
- [browser-esbuild] live-reload=false workflow is less convenient now
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.