0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Angular ngForで配列要素の最初の1つだけを取得する方法

Last updated at Posted at 2020-08-30

#ngForの最初の配列要素だけ取る

*ngFor='let item of items | slice:start:end;'

このようにsliceを使う事でできました!

スクリーンショット 2020-08-27 12.18.45.jpg

sliceを使う事で、自由に取得したい配列要素を指定できます。

*ngFor='let item of items | slice:0:10;'

例えば、こうすれば10個だけ取得することができます!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?