Issue with angular Router
See original GitHub issueI’m receiving an error I haven’t been able to find my way around. I’m on Storybook 5.0.10 using angular.
Here is the error:
Template parse errors: Can't bind to 'routerLink' since it isn't a known property of 'a'. (" <a *ngIf="tabType === 'link'" [ERROR ->][routerLink]="" [fragment]="tab.id" (click)="!!select(tab.id)" class="util-tabset__li"): ng:///DynamicModule/UtilTabsetComponent.html@20:8 Can't bind to 'fragment' since it isn't a known property of 'a'. (" <a *ngIf="tabType === 'link'" [routerLink]="" [ERROR ->][fragment]="tab.id" (click)="!!select(tab.id)" class="util-tabset__link" "): ng:///DynamicModule/UtilTabsetComponent.html@20:24
Error: Template parse errors:
Can't bind to 'routerLink' since it isn't a known property of 'a'. ("
<a *ngIf="tabType === 'link'"
[ERROR ->][routerLink]="" [fragment]="tab.id"
(click)="!!select(tab.id)"
class="util-tabset__li"): ng:///DynamicModule/UtilTabsetComponent.html@20:8
Can't bind to 'fragment' since it isn't a known property of 'a'. ("
<a *ngIf="tabType === 'link'"
[routerLink]="" [ERROR ->][fragment]="tab.id"
(click)="!!select(tab.id)"
class="util-tabset__link"
"): ng:///DynamicModule/UtilTabsetComponent.html@20:24
at syntaxError (http://localhost:6006/vendors~main.0afdbd165a15faa9fe9e.bundle.js:11068:17)
at TemplateParser.push../node_modules/@angular/compiler/fesm5/compiler.js.TemplateParser.parse (http://localhost:6006/vendors~main.0afdbd165a15faa9fe9e.bundle.js:29243:19)
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._parseTemplate (http://localhost:6006/vendors~main.0afdbd165a15faa9fe9e.bundle.js:34809:37)
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileTemplate (http://localhost:6006/vendors~main.0afdbd165a15faa9fe9e.bundle.js:34796:23)
at http://localhost:6006/vendors~main.0afdbd165a15faa9fe9e.bundle.js:34739:62
at Set.forEach (<anonymous>)
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileComponents (http://localhost:6006/vendors~main.0afdbd165a15faa9fe9e.bundle.js:34739:19)
at http://localhost:6006/vendors~main.0afdbd165a15faa9fe9e.bundle.js:34649:19
at Object.then (http://localhost:6006/vendors~main.0afdbd165a15faa9fe9e.bundle.js:11059:77)
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents (http://localhost:6006/vendors~main.0afdbd165a15faa9fe9e.bundle.js:34648:26)
and here is my story:
import { storiesOf, moduleMetadata } from '@storybook/angular';
import { UtilTabDirective } from './util-tab.directive';
import { UtilTabsetComponent } from './util-tabset.component';
// Initiate story
storiesOf('Utility/Tabs/Tab Set', module)
.addDecorator(
moduleMetadata({
declarations: [UtilTabsetComponent, UtilTabDirective],
}),
)
.add('Tab Set', () => ({
component: UtilTabsetComponent,
props: {
},
}))
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Troubleshooting Angular routing - Medium
Here is the summary of possible troubles: 'router-outlet' is not a known element — did you export RouterModule in your app-routing. module.
Read more >Issues · angular/router - GitHub
Issues list ; Routing works wrong with included routes. #449 opened on Jan 27, 2021 ; Angular routing uses window.location url for routing...
Read more >Angular 4 Routing Issues - Stack Overflow
Try Changing the route to some thing like this const appRoutes: Routes = [ { path:'', redirectTo: 'first', pathMatch: 'full' }, { path: ......
Read more >Some Tips For Angular Routing Issues - C# Corner
* Define what the router should do if it receives a navigation request to the current URL. * current URL. Default is 'ignore'....
Read more >Common Routing Tasks - Angular
This topic describes how to implement many of the common tasks associated with adding the Angular router to your application.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is no need to mock the
RouterLinkWithHref
Directive.Just remember to provide a value for the
APP_BASE_HREF
token. Example:Use
forRoot
even if in the original Module you’ve usedforChild
.Or, just discovered, use
RouterTestingModule
. Example:More an Angular issue that a SB issue but here it is:
You need to add
RouterModule
to the list of declarations: