Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 未捕获错误:模板分析错误:通过@prop=";分配动画触发器;exp";带有表达式的属性无效。_Angular - Fatal编程技术网

Angular 未捕获错误:模板分析错误:通过@prop=";分配动画触发器;exp";带有表达式的属性无效。

Angular 未捕获错误:模板分析错误:通过@prop=";分配动画触发器;exp";带有表达式的属性无效。,angular,Angular,我使用的是Angular 5,cli 1.65 post.component.html中的这一行导致以下错误 谷歌控制台: Uncaught Error: Template parse errors: Assigning animation triggers via @prop="exp" attributes with an expression is invalid. Use property bindings (e.g. [@prop]="exp") or use an attribut

我使用的是Angular 5,cli 1.65

post.component.html中的这一行导致以下错误

谷歌控制台:

Uncaught Error: Template parse errors:
Assigning animation triggers via @prop="exp" attributes with an expression is invalid. Use property bindings (e.g. [@prop]="exp") or use an attribute without a value (e.g. @prop) instead. ("<ul class="list-group">
  <li  [ERROR ->]@ngFor="let post of posts" class="list-group-item"> {‌{ post.title }}</li>
任何帮助或提示都将不胜感激

将其更改为:

<li  *ngFor="let post of posts" class="list-group-item"> {{ post.title }}</li>
{{post.title}
.

谢谢!!!我用了“@”。相反,我应该使用“*”。谢谢你告诉我我的错误是什么
import { Component, OnInit } from '@angular/core';
import { Http } from '@angular/http';

@Component({
  selector: 'app-posts',
  templateUrl: './posts.component.html',
  styleUrls: ['./posts.component.css']
})
export class PostsComponent implements OnInit {

  posts: any[];
  constructor(http: Http) {
    http.get('http://jsonplaceholder.typicode.com/posts')
    .subscribe(response => {
      console.log(response.json());
      this.posts = response.json();
    }

    )
   }

  ngOnInit() {
  }

}
<li  *ngFor="let post of posts" class="list-group-item"> {{ post.title }}</li>