Category : local-storage

I have a component with 2 tables: 1)favouriteProjects 2)projects Link to picture The project will be send from my .html to my ts file and will be added to an favArray. If I click on the star next time, the project will be removed from the favourite table. How can I save the checked stars ..

Read more

I’ve been googling some time now and could not find a way to catch the exception of the browser’s Failed to execute ‘setItem’ on ‘Storage’: Setting the value of ‘[my state]’ exceeded the quota error. Easily testable by using this little script (remove the localStorage.removeItem(‘test’); to keep the data) and then just run your ngrx ..

Read more

I have the following expressions: This fetches the ID parameter passed through the URL: editUserId = this.route.snapshot.paramMap.get(‘id’); Then i used FindIndex on an array of objects to find the index of an element in the array equal to the above mentioned ID value fetched from the URL: this.userToUpdate = this.allUsers.findIndex((x: any) => x.UserId === this.editUserId); ..

Read more

I have a form which takes in user data. I am trying to write this inputted user data to my local storage. The first submit adds the record as expected, however, when trying to add a second record, the first records attributes are simply overwritten – do note, an array element is added, however its ..

Read more

I am trying to write multiple records to local storage using a form that accepts user information. However, I am confronted with the following error: "Paramater ‘user’ implicitly has an ‘any’ type." My code is as follows: addUserForm!: FormGroup; user: any = {}; onSubmit(): void { console.log(this.addUserForm.value); this.user = Object.assign(this.user, this.addUserForm.value); this.user(this.user); } addUser(user) { ..

Read more

i have a login page , on which, on submit of user details, it’ll get a response from api, im storing userid(from res) in localstorage…when i use that to display userid, it is not working untill i hit refresh button. onSubmit(data: any){ console.log(data); return this.http.post(this.baseURL,data).subscribe((result:any)=>{ console.log("result",result); this.locally_id=result.userDetails.userid; console.log(this.locally_id) this.cookieService.set(‘user_id’, this.id); this.cookieUseridValue = this.cookieService.get(‘user_id’); var cookieDetails ..

Read more