Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to push object in array in angular from an api

import { Component } from '@angular/core';
selector: 'my-app',
styleUrls: [ './app.component.css' ]
export class AppComponent {
name = 'Angular';
myArray = [1, 2, 3, 4, 5, 6];
addNew(){
myArray. push(this. myArray. length + 1);
 
PREVIOUS NEXT
Tagged: #push #object #array #angular #api
ADD COMMENT
Topic
Name
9+7 =