【发布时间】:2019-10-09 23:24:20
【问题描述】:
我是一个angular初学者,我开发了一个小应用程序,但是我有一个问题,*ngIf,*ngFor,nfForm 不起作用(我认为错误 CommonModule)
文件.html:
<div class="col-sm-3 form-group">
<div>
<select class="form-control">
<option selected value="">Select Project</option>
<option *ngFor='let app of projetsa' [value]="app?.projectId">
{{app?.ProjetName}}
</option>
</select>
</div>
</div>
appModule.ts:
import { BrowserModule } from '@angular/platform-browser';
import { CommonModule } from '@angular/common';
.
.
.
@NgModule({
declarations: [...],
imports: [ BrowserModule, CommonModule,...],
providers: [...],
bootstrap: [AppComponent]
})
export class AppModule { }
export function getBaseUrl() {
return document.getElementsByTagName('base')[0].href;
}
package.json:
"dependencies": {
"@angular/animations": "^5.0.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/material": "^7.3.7",
.
.
.
}
【问题讨论】: