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

ng generate route <name> created scaffolds not working. #989

Closed
UzairNoman opened this issue Jun 2, 2016 · 10 comments
Closed

ng generate route <name> created scaffolds not working. #989

UzairNoman opened this issue Jun 2, 2016 · 10 comments
Labels
needs: repro steps We cannot reproduce the issue with the information given type: RFC / discussion / question

Comments

@UzairNoman
Copy link

I created the routes with angular cli, it created all the scaffolds and necessary references in the parent component :

@Routes([ {path: '/hero', component: HeroComponent} ])

Also added the router outlet tag in the parent component's HTML template.Everything seems fine but still when i try to access that route,I see the parent template outputting but component whose template has to be resolved in the router outlet tag is not visible.
Although when I tried to make the project folder with npm as guided in the official angular docs,route works fine.

@filipesilva
Copy link
Contributor

@UzairNouman that's odd. Can you give me exact reproduction steps that I can follow so I can debug it?

@filipesilva filipesilva added command: generate needs: repro steps We cannot reproduce the issue with the information given labels Jun 2, 2016
@UzairNoman
Copy link
Author

Yeah,that's too odd.Maybe I am missing something.
I created a fresh project with angular cli Problem to test the routes problem.
What I concluded with the original docs,all you need to do to create a simple route is to follow 3 main steps,angular-cli does all that job with a single command, so why it is not working?

1-is to make changes to main component

ProblemComponent
problemcomp

2-make changes to the Route Component

HeroComponent

hero

3-Create <router-outlet>

Problem Component's HTML

problemhtml

Project Structure

ps

Output

op

You may have noticed HeroComponent in my directives,I was testing it by adding <app-hero> tag in the problem.component.html and surprisingly it works.

@graknol
Copy link

graknol commented Jun 2, 2016

I am experiencing this too, I don't know, but perhaps it's something with the way angular-cli serves the files? I don't really know

@fadeojo
Copy link

fadeojo commented Jun 3, 2016

@graknol I had the same issue and this

import { RouteConfig , ROUTER_DIRECTIVES, ROUTER_PROVIDERS} from '@angular/router-deprecated';
@Component({
  moduleId: module.id,
  selector: 'hello-app',
  directives: [ROUTER_DIRECTIVES],
  templateUrl: 'hello.component.html',
  styleUrls: ['hello.component.css'],
  providers: [ROUTER_PROVIDERS]
})
@RouteConfig([
  {path: '/login',    component: LoginComponent,     name: 'Login'}
])

fixed it. The router is broken in RC1 has breaking changes.

@UzairNoman
Copy link
Author

angular-cli is using '@angular/router', @fadeojo can you tell me how you are using '@angular/router-deprecated'?

@planser
Copy link

planser commented Jun 3, 2016

@UzairNouman try npm installing @angular/router-deprecated and adding the entry @angular/router-deprecated to Angular specific barrels in system-config.ts. It worked for me...

@oadeojo
Copy link

oadeojo commented Jun 3, 2016

@UzairNouman the router has breaking changes for RC1. https://github.com/angular/angular/blob/master/CHANGELOG.md

@sonicoder86
Copy link

Here are some bug reports on the main repository that might help till it gets fixed.
angular/angular#8409
angular/angular#9020

@UzairNoman
Copy link
Author

UzairNoman commented Jun 7, 2016

Thanks @planser,your suggestion solved the issue.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: repro steps We cannot reproduce the issue with the information given type: RFC / discussion / question
Projects
None yet
Development

No branches or pull requests

7 participants