0

TypeError: this.options.pull is not a function getting this error in angular

I am having an array "options".In this array I am trying to change one element on every click.. oninit i am pushing one element in to this array and after clicking an option i need to pull out that last element and push other element in place of the last element.But getting error mentioned above.I am able to push but not able to pull out .Can anybody help me to resolve this. i have already tried with delete and remove methods but getting the same error

 ngOnInit() {
   
this.arrayform();

x:any;
  arrayform()
  {
   
    
   this.x=this.saveCap[this.userIndex]
    console.log(this.x)
     this.options.push(this.x)
  
   console.log(this.options)
   console.log(this.x)
  }
  arrayDel(){
    console.log(this.options)
   console.log(typeof(this.options)) 
    console.log(this.x)
    this.options.pull(this.x)
  }
 checkoptions(){
    this.userIndex++
  //  this.options.remove(this.x)
  this.arrayDel();
    this.arrayform();
    
  }
  
}
10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.