- Can't bind to 'ng-forOf' since it isn't a known native property
With Angular 2.1.0+ It seems this is the same except you should import the BrowserModule in your app module and import CommonModule in others (you can't import BrowserModule twice with routes lazy-loading).
With Angular 2 rc5 : This version introduced NgModules, you need to import BrowserModule in your module(s) in order to use ngFor, and ngIf:
import { NgModule } from "@angular/core"
import { BrowserModule } from '@angular/platform-browser';
@NgModule({
exports: [VoteTakerComponent],
imports: [BrowserModule],
})
export class VoteTakerModule {
}
- Can't bind to 'routerLink' since it isn't a known property of 'a' [duplicate]
The problem is that you forgot to add RouterModule to your NgModule component. In the RC this was added to the @Component({directives: [ROUTER_DIRECTIVES]}), however, this is now moved into @NgModule({ imports: [RouterModule]}).
So, you will get the RouterLink either this way, or via direct import into imports property of @NgModule.
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { JueJin } from '../juejin/juejin.component'
export const routes: Routes = [
{ path: 'juejin', component: JueJin },
];
@NgModule({
exports: [RouterModule]
})
export class AppRoutingModule { }