You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Broccoli Plugin: [BroccoliTypeScriptCompiler] failed with:
Error: Typescript found the following errors:
/Users/nbhati/projects/angular2-seed-cli/tmp/broccoli_type_script_compiler-input_base_path-jPwD2Y7Q.tmp/0/src/app/angular2-seed-cli.component.ts (13, 45): Argument of type '{ path: string; component: typeof HomeComponent; useAsDefault: boolean; }[]' is not assignable to parameter of type 'RouteMetadata[]'.
Type '{ path: string; component: typeof HomeComponent; useAsDefault: boolean; }' is not assignable to type 'RouteMetadata'.
The RC 1 router documentation is starting to come in. The examples are instantiating the default route in ngOnInit(). Here's how I modified the CLI generated code to start the app with the default route:
import { Component, OnInit } from '@angular/core';
import { HomeComponent } from './+home';
import { Routes, Route, Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS} from '@angular/router';
import { AboutComponent } from './+about';
@Component({
moduleId: module.id,
selector: 'angular-cli-demo-app',
templateUrl: 'angular-cli-demo.component.html',
styleUrls: ['angular-cli-demo.component.css'],
directives: [ROUTER_DIRECTIVES],
providers: [ROUTER_PROVIDERS]
})
@Routes([
new Route({path: '/', component: HomeComponent}),
new Route({path: '/about', component: AboutComponent})
])
export class AngularCliDemoAppComponent implements OnInit {
title = 'Angular CLI Demo';
constructor(private router: Router) {}
ngOnInit() {
this.router.navigate(['/']);
}
}
after you import.. Route, Router, you don't need new Route()
also I'm not sure why is creating the routes with + (./+home, ./+about) ... I did a little reading and this means the routes are lazy loaded :)
Activity
bug: provider not being added to the app component
bug: provider not being added to the app component
nareshbhatia commentedon May 5, 2016
FYI, this is still not working for me. I am running from master and did the npm-link thingy as described in README.md, but still the same issue.
nareshbhatia commentedon May 6, 2016
@Brocco, as far as I can tell, the commit above does not address this issue. The rc.1 router requires routes to be like this:
The cli is generating this:
Brocco commentedon May 6, 2016
@nareshbhatia right now it appears that the router does not support default, so when generating routes please do not use
--defaultAlso an issue was found about adding the route provider when the provider array already exists on the root component.
This will be tracked via #656
nareshbhatia commentedon May 6, 2016
Sounds good.
nareshbhatia commentedon May 6, 2016
It seems that the new way to specify the default path is to simply set it to '/':
So the CLI may have to translate
ng g route home --defaultto a path of/.nareshbhatia commentedon May 6, 2016
The RC 1 router documentation is starting to come in. The examples are instantiating the default route in
ngOnInit(). Here's how I modified the CLI generated code to start the app with the default route:scastaldi commentedon Jun 3, 2016
after you import.. Route, Router, you don't need new Route()
also I'm not sure why is creating the routes with + (./+home, ./+about) ... I did a little reading and this means the routes are lazy loaded :)
shangab commentedon Aug 25, 2016
Ah, what?? @routes ??
What is going on, why routing is not stable. I mean, this is backbone of every web piece guys.
angular-automatic-lock-bot commentedon Sep 6, 2019
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.