简体   繁体   English

角度错误:无法绑定到'ngForFrom',因为它不是'a'的已知属性

[英]Angular error : Can't bind to 'ngForFrom' since it isn't a known property of 'a'

This is not a new error I believe. 这不是我认为的新错误。 I've tried most of the things that solved the error, but I'm not able to fix it. 我已经尝试了解决错误的大部分问题,但我无法修复它。 Here's my appModule.ts file 这是我的appModule.ts文件

import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { BrowserModule } from '@angular/platform-browser';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    CommonModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Looks like I have everything needed, let me know if anythings missing. 看起来我有所需的一切,如果有任何遗失,请告诉我。 And here you can see my template, app.component.html 在这里,您可以看到我的模板app.component.html

<div class="container">
<span class="text-center">
    <h1>{{Portfolio.firstName+' '+Portfolio.middleName+' '+Portfolio.lastName[0]}}</h1>
    <h2 class="subHeading">{{Portfolio.subheading}}</h2>
    <img src="../assets/img/me.JPG" class="rounded-circle mx-auto d-block smallerImg">
</span>
<div class="row justify-content-center">
    <a [href]="social.link" class="p-2" target="blank"
     *ngFor="let social from Portfolio.socialMedia">
        <i [style.color]="social.color" [class]="social.icon"></i>
    </a>
</div>
</div>  

And here is my app.component.ts file 这是我的app.component.ts文件

import { Component} from '@angular/core';
import  { CommonModule} from '@angular/common';
import { OnInit, NgModule } from '@angular/core';
import { Portfolio } from './../models/portfolio.interface';
 socialMedia: [
    {
      icon: 'fa fa-linkedin fa-2x',
      link: 'https://www.linkedin.com/in/akshay-kumar-603740136/',
      color: '#007bb6'
    },
    {
      icon: 'fab fa-github',
      link: 'https://github.com/akkie00',
      color: '#6e5494'
    }
  ],

in which you can see the array I'm trying to loop through. 在其中你可以看到我试图循环的数组。 This is the error I'm getting : 这是我得到的错误:

    compiler.js:486 Uncaught Error: Template parse errors:
Can't bind to 'ngForFrom' since it isn't a known property of 'a'. ("v class="row justify-content-center">
    <a [href]="social.link" class="p-2" target="blank"
     [ERROR ->]*ngFor="let social from Portfolio.socialMedia">
        <i [style.color]="social.color" [class]="soc"): ng:///AppModule/AppComponent.html@8:5
Property binding ngForFrom not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("
</span>

Any help is much appreciated. 任何帮助深表感谢。

Try 尝试

*ngFor="let social of Portfolio.socialMedia"

from is the wrong keyword. from错误的关键字。 Use of 使用of

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 例外:模板解析错误:由于它不是已知的本机属性,因此无法绑定到“ ngForFrom” - EXCEPTION: Template parse errors: Can't bind to 'ngForFrom' since it isn't a known native property 角度-无法绑定到“属性”,因为它不是“ a”的已知属性 - Angular - Can't bind to 'property' since it isn't a known property of 'a' 无法绑定,因为它不是角度分量的已知属性 - Can't bind since it isn't a known property of angular component 无法绑定到“”,因为它不是“ angular 2”的已知属性 - can't bind to '' since it isn't a known property of '' angular 2 EventEmitter - 无法绑定,因为它不是已知属性 - Angular 8 - EventEmitter - Can't bind since it isn't a known property - Angular 8 Angular 7 无法绑定到“routerlink”,因为它不是“a”的已知属性 - Angular 7 and can't bind to 'routerlink' since it isn't a known property of 'a' 无法绑定到“ngForOf”,因为它不是 angular 5 中的已知属性 - Can't bind to 'ngForOf' since it isn't a known property in angular 5 Angular 2无法绑定到'ngif',因为它不是已知属性 - Angular 2 Can't bind to 'ngif' since it isn't a known property Angular 6 无法绑定到“*ngIf”,因为它不是已知属性 - Angular 6 Can't bind to '*ngIf' since it isn't a known property Angular 2 RC 5 - 无法绑定到&#39;...&#39;,因为它不是&#39;...&#39;的已知属性 - Angular 2 RC 5 - Can't bind to '…' since it isn't a known property of '…'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM