[Ionic 4] Can't bind to 'name' since it isn't a known property of 'ion-router-outlet'
See original GitHub issueBug Report
Ionic Info
Run ionic info
from a terminal/cmd prompt and paste the output below.
Ionic:
ionic (Ionic CLI) : 4.0.6
Ionic Framework : @ionic/angular 4.0.0-beta.2
@angular-devkit/core : 0.7.3
@angular-devkit/schematics : 0.7.3
@angular/cli : 6.1.3
@ionic/ng-toolkit : 1.0.6
@ionic/schematics-angular : 1.0.4
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.0.0, ios 4.5.5
System:
Android SDK Tools : 25.2.5
ios-deploy : 1.9.2
ios-sim : 6.1.2
NodeJS : v8.9.4 (/Users/dtaalbers/.nvm/versions/node/v8.9.4/bin/node)
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 9.4.1 Build version 9F2000
Environment:
ANDROID_HOME : /usr/local/Cellar/android-sdk/24.4.1_1
Describe the Bug
I am trying to generate tabs based of the roles the current user has. Can’t bind property to name of the ion-router-outlet
component. I tried both
<ion-router-outlet name="{{tab.name}}"></ion-router-outlet>
and
<ion-router-outlet [name]="tab.name"></ion-router-outlet>
When I remove the name
binding of the outlet component I get the following error
Error: Cannot find a differ supporting object '[object HTMLElement]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.
This error can be fixed with a pipe explained here but its still doesn’t iterate over my tabs.
Related Code My viewmodel
export class TabsPage extends BaseComponent implements OnInit {
private availableTabs: any[] = [
{
label: 'Collecties',
name: 'pictures',
icon: 'images',
href: '/tabs/(pictures:pictures)',
roles: [
UserRoles.ReadPictures
]
},
{
label: 'Profiel',
name: 'my-profile',
icon: 'person',
href: '/tabs/(my-profile:my-profile)',
},
{
label: 'Over',
name: 'about',
icon: 'phone-portrait',
href: '/tabs/(about:about)',
}
];
private tabs: any[] = [];
public async ngOnInit(): Promise<void> {
await super.ngOnInit();
this.generateTabs();
}
private generateTabs(): void {
for (const tab of this.availableTabs) {
if (!tab.roles) {
this.tabs.push(tab);
} else {
if (tab.roles.some(x => this.currentUser.roles.some(y => y === x))) {
this.tabs.push(tab);
}
}
}
}
}
View:
<ion-tabs *ngIf="tabs.length > 0" #tabs color="primary">
<ion-tab label="Home" icon="home" href="/tabs/(home:home)">
<ion-router-outlet name="home"></ion-router-outlet>
</ion-tab>
<ion-tab *ngFor="let tab of tabs" [label]="tab.label" [icon]="tab.icon" [href]="tab.href">
<ion-router-outlet name="{{tab.name}}"></ion-router-outlet>
</ion-tab>
</ion-tabs>
Expected Behavior
I expect to be able to bind to the name
property and iterate the tabs array to generate tabs.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
[Ionic 4] Can't bind to 'name' since it isn't a known property of ...
Run ionic info from a terminal/cmd prompt and paste the output below. Ionic: ionic (Ionic CLI) : 4.0.6 Ionic Framework : @ionic/angular 4.0.0- ......
Read more >Can't bind to 'ngIF' since it isn't a known property of 'ion-item'
I need to use *ngIF inside the code of my ionic4 project, found some answers but none works as none is targeting ionic...
Read more >Ion-Menu isn't displayed - ionic-v3
Hi, I started programming with ionic and I want to create a page with ... errors: Can't bind to 'content' since it isn't...
Read more >Angular error Can't bind to 'ngModel' since it isn't a ... - YouTube
Learn Angular in Mumbai offline http://stepbystepschools.net/ For more ... Can't bind to 'ngModel' since it isn't a known property of input.
Read more >[Debugging] Can't bind to {prop} since it isn't a know property ...
In this video, you'll learn what the error " Can't bind to {prop} since it isn't a know property of {node}" means, how...
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
you can not bind the name property to router-outlet. This is a problem with Angular not with Ionic. See https://github.com/angular/angular/issues/12522
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.