私は角度2を学習しています。この例では、isLoadingの変数をtrueに設定し、それをfalseに変更します。必要、私はエラーを取得する:Typescript - 型 'true'に代入することはできません
Typescript - type 'false' is not assignable to type 'true'
これはコードです:
export class AppComponent implements OnInit {
isLoading: true;
constructor(private _articleService: ArticleService, private _postService: PostService){}
ngOnInit(){
this.articles = this._articleService.getArticles();
this._postService.getPosts()
.subscribe(posts => {
this.isLoading = false;
console.log(posts[0].title);
});
}
'isLoading:真;' - > 'isLoading =真;' – jonrsharpe
'isLoading:ブール;' –