slice() is the method of the Array, but you are calling it for the object.

Use Object.values() to make it to array.

export class AppComponent {
  color: string = 'green';
  public stocklist = [];
  public objectKeys = Object.keys;
  constructor() {
    let url = 'http://localhost:8080/stocks';
    axios.get(url).then(res =>{
      this.stocklist = Object.values(res.data.result[0]).slice(0,10);
      console.log(this.stocklist);
    })
  }
}
Answer from topdev87 on Stack Overflow
🌐
TutorialsPoint
tutorialspoint.com › home › typescript › typescript array slice
TypeScript Array Slice
December 18, 2016 - Returns the extracted array based on the passed parameters. var arr = ["orange", "mango", "banana", "sugar", "tea"]; console.log("arr.slice( 1, 2) : " + arr.slice( 1, 2) ); console.log("arr.slice( 1, 3) : " + arr.slice( 1, 3) );
🌐
Angular
angular.dev › api › common › SlicePipe
SlicePipe • Angular
Creates a new Array or String containing a subset (slice) of the elements.
🌐
ConcretePage
concretepage.com › angular-2 › angular-2-slice-pipe-example
Angular Slice Pipe - ConcretePage.com
The SlicePipe is Angular CommonModule API. Slice pipe slices a given array or string into subsets. We need to provide start and end index. The SlicePipe uses slice keyword with pipe operator.
🌐
GeeksforGeeks
geeksforgeeks.org › typescript › typescript-array-slice-method
TypeScript Array slice() Method - GeeksforGeeks
August 8, 2024 - // Driver code let arr: number[] ... console.log(val); ... Example 2: In this example we defines a string array arr, then uses the slice() method to extract portions of the array into val....
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › slice
Array.prototype.slice() - JavaScript | MDN
The slice() method of Array instances returns a shallow copy of a portion of an array into a new array object selected from start to end (end not included) where start and end represent the index of items in that array. The original array will not be modified.
🌐
JSFiddle
jsfiddle.net › BinaryMuse › vQUsS
Angular `slice` filter for arrays - JSFiddle - Code Playground
JSFiddle - Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle.
Find elsewhere
🌐
Angular
v2.angular.io › docs › ts › latest › api › common › index › SlicePipe-pipe.html
SlicePipe - ts - API
Creates a new List or String containing a subset (slice) of the elements. array_or_string_expression | slice:start[:end] CommonModule · Where the input expression is a List or String, and: start: The starting index of the subset to return. ...
🌐
Educative
educative.io › answers › what-is-arrayslice-in-typescript
What is array.slice() in TypeScript?
Lines 9–12: We extract some parts of the arrays that we created using the slice() method.
🌐
Angular
v17.angular.io › api › common › SlicePipe
Angular
Angular is a platform for building mobile and desktop web applications. Join the community of millions of developers who build compelling user interfaces with Angular.
🌐
ItSolutionstuff
itsolutionstuff.com › post › angular-9-8-slice-pipe-example-slice-pipe-in-angularexample.html
Angular Slice Pipe Example | Slice Pipe in Angular - ItSolutionstuff.com
May 2, 2024 - It will start from 2 key and end with -3. it means it will take key value from last end of array. ... I hope it can help you... Tags: Angular Angular 6 Angular 7 Angular 8 Angular 9
🌐
W3Schools
w3schools.com › jsref › jsref_slice_array.asp
JavaScript Array slice() Method
The slice() method returns selected elements in a new array.
🌐
GitHub
github.com › angular › vscode-ng-language-service › issues › 345
ngFor with slice pipe loses object type · Issue #345 · angular/vscode-ng-language-service
July 15, 2019 - angular / vscode-ng-language-service Public archive ... This repository was archived by the owner on Nov 21, 2025. It is now read-only. ... ... availabilityArray = [ { available: true }, { available: false }, { available: true }, { available: false } ]; ... <ng-container *ngFor="let element of availabilityArray | slice:0:10"> {{ element.available }} </ng-container>
Published   Jul 15, 2019
🌐
Javatpoint
javatpoint.com › javascript-array-slice-method
JavaScript Array slice() method
slice() - JavaScript Array slice() Method with example, javascript array methods, concat() method, every() method, filter() method, forEach() method, join() method, indexOf() method, lastIndexOf() method, map() method, push() method, slice() method, sort() method, unshift() method, toSource() method etc.